
kernel:     file format elf32-i386


Disassembly of section .text:

80100000 <multiboot_header>:
80100000:	02 b0 ad 1b 00 00    	add    0x1bad(%eax),%dh
80100006:	00 00                	add    %al,(%eax)
80100008:	fe 4f 52             	decb   0x52(%edi)
8010000b:	e4 0f                	in     $0xf,%al

8010000c <entry>:

# Entering xv6 on boot processor, with paging off.
.globl entry
entry:
  # Turn on page size extension for 4Mbyte pages
  movl    %cr4, %eax
8010000c:	0f 20 e0             	mov    %cr4,%eax
  orl     $(CR4_PSE), %eax
8010000f:	83 c8 10             	or     $0x10,%eax
  movl    %eax, %cr4
80100012:	0f 22 e0             	mov    %eax,%cr4
  # Set page directory
  movl    $(V2P_WO(entrypgdir)), %eax
80100015:	b8 00 b0 10 00       	mov    $0x10b000,%eax
  movl    %eax, %cr3
8010001a:	0f 22 d8             	mov    %eax,%cr3
  # Turn on paging.
  movl    %cr0, %eax
8010001d:	0f 20 c0             	mov    %cr0,%eax
  orl     $(CR0_PG|CR0_WP), %eax
80100020:	0d 00 00 01 80       	or     $0x80010000,%eax
  movl    %eax, %cr0
80100025:	0f 22 c0             	mov    %eax,%cr0

  # Set up the stack pointer.
  movl $(stack + KSTACKSIZE), %esp
80100028:	bc 60 d6 10 80       	mov    $0x8010d660,%esp

  # Jump to main(), and switch to executing at
  # high addresses. The indirect call is needed because
  # the assembler produces a PC-relative instruction
  # for a direct jump.
  mov $main, %eax
8010002d:	b8 1b 35 10 80       	mov    $0x8010351b,%eax
  jmp *%eax
80100032:	ff e0                	jmp    *%eax

80100034 <binit>:
  struct buf head;
} bcache;

void
binit(void)
{
80100034:	55                   	push   %ebp
80100035:	89 e5                	mov    %esp,%ebp
80100037:	83 ec 28             	sub    $0x28,%esp
  struct buf *b;

  initlock(&bcache.lock, "bcache");
8010003a:	c7 44 24 04 7c 88 10 	movl   $0x8010887c,0x4(%esp)
80100041:	80 
80100042:	c7 04 24 60 d6 10 80 	movl   $0x8010d660,(%esp)
80100049:	e8 dc 4b 00 00       	call   80104c2a <initlock>

//PAGEBREAK!
  // Create linked list of buffers
  bcache.head.prev = &bcache.head;
8010004e:	c7 05 90 eb 10 80 84 	movl   $0x8010eb84,0x8010eb90
80100055:	eb 10 80 
  bcache.head.next = &bcache.head;
80100058:	c7 05 94 eb 10 80 84 	movl   $0x8010eb84,0x8010eb94
8010005f:	eb 10 80 
  for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100062:	c7 45 f4 94 d6 10 80 	movl   $0x8010d694,-0xc(%ebp)
80100069:	eb 3a                	jmp    801000a5 <binit+0x71>
    b->next = bcache.head.next;
8010006b:	8b 15 94 eb 10 80    	mov    0x8010eb94,%edx
80100071:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100074:	89 50 10             	mov    %edx,0x10(%eax)
    b->prev = &bcache.head;
80100077:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010007a:	c7 40 0c 84 eb 10 80 	movl   $0x8010eb84,0xc(%eax)
    b->dev = -1;
80100081:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100084:	c7 40 04 ff ff ff ff 	movl   $0xffffffff,0x4(%eax)
    bcache.head.next->prev = b;
8010008b:	a1 94 eb 10 80       	mov    0x8010eb94,%eax
80100090:	8b 55 f4             	mov    -0xc(%ebp),%edx
80100093:	89 50 0c             	mov    %edx,0xc(%eax)
    bcache.head.next = b;
80100096:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100099:	a3 94 eb 10 80       	mov    %eax,0x8010eb94

//PAGEBREAK!
  // Create linked list of buffers
  bcache.head.prev = &bcache.head;
  bcache.head.next = &bcache.head;
  for(b = bcache.buf; b < bcache.buf+NBUF; b++){
8010009e:	81 45 f4 18 02 00 00 	addl   $0x218,-0xc(%ebp)
801000a5:	81 7d f4 84 eb 10 80 	cmpl   $0x8010eb84,-0xc(%ebp)
801000ac:	72 bd                	jb     8010006b <binit+0x37>
    b->prev = &bcache.head;
    b->dev = -1;
    bcache.head.next->prev = b;
    bcache.head.next = b;
  }
}
801000ae:	c9                   	leave  
801000af:	c3                   	ret    

801000b0 <bget>:
// Look through buffer cache for sector on device dev.
// If not found, allocate fresh block.
// In either case, return B_BUSY buffer.
static struct buf*
bget(uint dev, uint sector)
{
801000b0:	55                   	push   %ebp
801000b1:	89 e5                	mov    %esp,%ebp
801000b3:	83 ec 28             	sub    $0x28,%esp
  struct buf *b;

  acquire(&bcache.lock);
801000b6:	c7 04 24 60 d6 10 80 	movl   $0x8010d660,(%esp)
801000bd:	e8 89 4b 00 00       	call   80104c4b <acquire>

 loop:
  // Is the sector already cached?
  for(b = bcache.head.next; b != &bcache.head; b = b->next){
801000c2:	a1 94 eb 10 80       	mov    0x8010eb94,%eax
801000c7:	89 45 f4             	mov    %eax,-0xc(%ebp)
801000ca:	eb 63                	jmp    8010012f <bget+0x7f>
    if(b->dev == dev && b->sector == sector){
801000cc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000cf:	8b 40 04             	mov    0x4(%eax),%eax
801000d2:	3b 45 08             	cmp    0x8(%ebp),%eax
801000d5:	75 4f                	jne    80100126 <bget+0x76>
801000d7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000da:	8b 40 08             	mov    0x8(%eax),%eax
801000dd:	3b 45 0c             	cmp    0xc(%ebp),%eax
801000e0:	75 44                	jne    80100126 <bget+0x76>
      if(!(b->flags & B_BUSY)){
801000e2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000e5:	8b 00                	mov    (%eax),%eax
801000e7:	83 e0 01             	and    $0x1,%eax
801000ea:	85 c0                	test   %eax,%eax
801000ec:	75 23                	jne    80100111 <bget+0x61>
        b->flags |= B_BUSY;
801000ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000f1:	8b 00                	mov    (%eax),%eax
801000f3:	89 c2                	mov    %eax,%edx
801000f5:	83 ca 01             	or     $0x1,%edx
801000f8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000fb:	89 10                	mov    %edx,(%eax)
        release(&bcache.lock);
801000fd:	c7 04 24 60 d6 10 80 	movl   $0x8010d660,(%esp)
80100104:	e8 a4 4b 00 00       	call   80104cad <release>
        return b;
80100109:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010010c:	e9 93 00 00 00       	jmp    801001a4 <bget+0xf4>
      }
      sleep(b, &bcache.lock);
80100111:	c7 44 24 04 60 d6 10 	movl   $0x8010d660,0x4(%esp)
80100118:	80 
80100119:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010011c:	89 04 24             	mov    %eax,(%esp)
8010011f:	e8 65 48 00 00       	call   80104989 <sleep>
      goto loop;
80100124:	eb 9c                	jmp    801000c2 <bget+0x12>

  acquire(&bcache.lock);

 loop:
  // Is the sector already cached?
  for(b = bcache.head.next; b != &bcache.head; b = b->next){
80100126:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100129:	8b 40 10             	mov    0x10(%eax),%eax
8010012c:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010012f:	81 7d f4 84 eb 10 80 	cmpl   $0x8010eb84,-0xc(%ebp)
80100136:	75 94                	jne    801000cc <bget+0x1c>
      goto loop;
    }
  }

  // Not cached; recycle some non-busy and clean buffer.
  for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100138:	a1 90 eb 10 80       	mov    0x8010eb90,%eax
8010013d:	89 45 f4             	mov    %eax,-0xc(%ebp)
80100140:	eb 4d                	jmp    8010018f <bget+0xdf>
    if((b->flags & B_BUSY) == 0 && (b->flags & B_DIRTY) == 0){
80100142:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100145:	8b 00                	mov    (%eax),%eax
80100147:	83 e0 01             	and    $0x1,%eax
8010014a:	85 c0                	test   %eax,%eax
8010014c:	75 38                	jne    80100186 <bget+0xd6>
8010014e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100151:	8b 00                	mov    (%eax),%eax
80100153:	83 e0 04             	and    $0x4,%eax
80100156:	85 c0                	test   %eax,%eax
80100158:	75 2c                	jne    80100186 <bget+0xd6>
      b->dev = dev;
8010015a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010015d:	8b 55 08             	mov    0x8(%ebp),%edx
80100160:	89 50 04             	mov    %edx,0x4(%eax)
      b->sector = sector;
80100163:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100166:	8b 55 0c             	mov    0xc(%ebp),%edx
80100169:	89 50 08             	mov    %edx,0x8(%eax)
      b->flags = B_BUSY;
8010016c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010016f:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
      release(&bcache.lock);
80100175:	c7 04 24 60 d6 10 80 	movl   $0x8010d660,(%esp)
8010017c:	e8 2c 4b 00 00       	call   80104cad <release>
      return b;
80100181:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100184:	eb 1e                	jmp    801001a4 <bget+0xf4>
      goto loop;
    }
  }

  // Not cached; recycle some non-busy and clean buffer.
  for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100186:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100189:	8b 40 0c             	mov    0xc(%eax),%eax
8010018c:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010018f:	81 7d f4 84 eb 10 80 	cmpl   $0x8010eb84,-0xc(%ebp)
80100196:	75 aa                	jne    80100142 <bget+0x92>
      b->flags = B_BUSY;
      release(&bcache.lock);
      return b;
    }
  }
  panic("bget: no buffers");
80100198:	c7 04 24 83 88 10 80 	movl   $0x80108883,(%esp)
8010019f:	e8 b1 03 00 00       	call   80100555 <panic>
}
801001a4:	c9                   	leave  
801001a5:	c3                   	ret    

801001a6 <bread>:

// Return a B_BUSY buf with the contents of the indicated disk sector.
struct buf*
bread(uint dev, uint sector)
{
801001a6:	55                   	push   %ebp
801001a7:	89 e5                	mov    %esp,%ebp
801001a9:	83 ec 28             	sub    $0x28,%esp
  struct buf *b;

  b = bget(dev, sector);
801001ac:	8b 45 0c             	mov    0xc(%ebp),%eax
801001af:	89 44 24 04          	mov    %eax,0x4(%esp)
801001b3:	8b 45 08             	mov    0x8(%ebp),%eax
801001b6:	89 04 24             	mov    %eax,(%esp)
801001b9:	e8 f2 fe ff ff       	call   801000b0 <bget>
801001be:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(!(b->flags & B_VALID))
801001c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801001c4:	8b 00                	mov    (%eax),%eax
801001c6:	83 e0 02             	and    $0x2,%eax
801001c9:	85 c0                	test   %eax,%eax
801001cb:	75 0b                	jne    801001d8 <bread+0x32>
    iderw(b);
801001cd:	8b 45 f4             	mov    -0xc(%ebp),%eax
801001d0:	89 04 24             	mov    %eax,(%esp)
801001d3:	e8 ec 25 00 00       	call   801027c4 <iderw>
  return b;
801001d8:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
801001db:	c9                   	leave  
801001dc:	c3                   	ret    

801001dd <bwrite>:

// Write b's contents to disk.  Must be B_BUSY.
void
bwrite(struct buf *b)
{
801001dd:	55                   	push   %ebp
801001de:	89 e5                	mov    %esp,%ebp
801001e0:	83 ec 18             	sub    $0x18,%esp
  if((b->flags & B_BUSY) == 0)
801001e3:	8b 45 08             	mov    0x8(%ebp),%eax
801001e6:	8b 00                	mov    (%eax),%eax
801001e8:	83 e0 01             	and    $0x1,%eax
801001eb:	85 c0                	test   %eax,%eax
801001ed:	75 0c                	jne    801001fb <bwrite+0x1e>
    panic("bwrite");
801001ef:	c7 04 24 94 88 10 80 	movl   $0x80108894,(%esp)
801001f6:	e8 5a 03 00 00       	call   80100555 <panic>
  b->flags |= B_DIRTY;
801001fb:	8b 45 08             	mov    0x8(%ebp),%eax
801001fe:	8b 00                	mov    (%eax),%eax
80100200:	89 c2                	mov    %eax,%edx
80100202:	83 ca 04             	or     $0x4,%edx
80100205:	8b 45 08             	mov    0x8(%ebp),%eax
80100208:	89 10                	mov    %edx,(%eax)
  iderw(b);
8010020a:	8b 45 08             	mov    0x8(%ebp),%eax
8010020d:	89 04 24             	mov    %eax,(%esp)
80100210:	e8 af 25 00 00       	call   801027c4 <iderw>
}
80100215:	c9                   	leave  
80100216:	c3                   	ret    

80100217 <brelse>:

// Release a B_BUSY buffer.
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
80100217:	55                   	push   %ebp
80100218:	89 e5                	mov    %esp,%ebp
8010021a:	83 ec 18             	sub    $0x18,%esp
  if((b->flags & B_BUSY) == 0)
8010021d:	8b 45 08             	mov    0x8(%ebp),%eax
80100220:	8b 00                	mov    (%eax),%eax
80100222:	83 e0 01             	and    $0x1,%eax
80100225:	85 c0                	test   %eax,%eax
80100227:	75 0c                	jne    80100235 <brelse+0x1e>
    panic("brelse");
80100229:	c7 04 24 9b 88 10 80 	movl   $0x8010889b,(%esp)
80100230:	e8 20 03 00 00       	call   80100555 <panic>

  acquire(&bcache.lock);
80100235:	c7 04 24 60 d6 10 80 	movl   $0x8010d660,(%esp)
8010023c:	e8 0a 4a 00 00       	call   80104c4b <acquire>

  b->next->prev = b->prev;
80100241:	8b 45 08             	mov    0x8(%ebp),%eax
80100244:	8b 40 10             	mov    0x10(%eax),%eax
80100247:	8b 55 08             	mov    0x8(%ebp),%edx
8010024a:	8b 52 0c             	mov    0xc(%edx),%edx
8010024d:	89 50 0c             	mov    %edx,0xc(%eax)
  b->prev->next = b->next;
80100250:	8b 45 08             	mov    0x8(%ebp),%eax
80100253:	8b 40 0c             	mov    0xc(%eax),%eax
80100256:	8b 55 08             	mov    0x8(%ebp),%edx
80100259:	8b 52 10             	mov    0x10(%edx),%edx
8010025c:	89 50 10             	mov    %edx,0x10(%eax)
  b->next = bcache.head.next;
8010025f:	8b 15 94 eb 10 80    	mov    0x8010eb94,%edx
80100265:	8b 45 08             	mov    0x8(%ebp),%eax
80100268:	89 50 10             	mov    %edx,0x10(%eax)
  b->prev = &bcache.head;
8010026b:	8b 45 08             	mov    0x8(%ebp),%eax
8010026e:	c7 40 0c 84 eb 10 80 	movl   $0x8010eb84,0xc(%eax)
  bcache.head.next->prev = b;
80100275:	a1 94 eb 10 80       	mov    0x8010eb94,%eax
8010027a:	8b 55 08             	mov    0x8(%ebp),%edx
8010027d:	89 50 0c             	mov    %edx,0xc(%eax)
  bcache.head.next = b;
80100280:	8b 45 08             	mov    0x8(%ebp),%eax
80100283:	a3 94 eb 10 80       	mov    %eax,0x8010eb94

  b->flags &= ~B_BUSY;
80100288:	8b 45 08             	mov    0x8(%ebp),%eax
8010028b:	8b 00                	mov    (%eax),%eax
8010028d:	89 c2                	mov    %eax,%edx
8010028f:	83 e2 fe             	and    $0xfffffffe,%edx
80100292:	8b 45 08             	mov    0x8(%ebp),%eax
80100295:	89 10                	mov    %edx,(%eax)
  wakeup(b);
80100297:	8b 45 08             	mov    0x8(%ebp),%eax
8010029a:	89 04 24             	mov    %eax,(%esp)
8010029d:	e8 c0 47 00 00       	call   80104a62 <wakeup>

  release(&bcache.lock);
801002a2:	c7 04 24 60 d6 10 80 	movl   $0x8010d660,(%esp)
801002a9:	e8 ff 49 00 00       	call   80104cad <release>
}
801002ae:	c9                   	leave  
801002af:	c3                   	ret    

801002b0 <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
801002b0:	55                   	push   %ebp
801002b1:	89 e5                	mov    %esp,%ebp
801002b3:	53                   	push   %ebx
801002b4:	83 ec 14             	sub    $0x14,%esp
801002b7:	8b 45 08             	mov    0x8(%ebp),%eax
801002ba:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801002be:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
801002c2:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
801002c6:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
801002ca:	ec                   	in     (%dx),%al
801002cb:	89 c3                	mov    %eax,%ebx
801002cd:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
801002d0:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
801002d4:	83 c4 14             	add    $0x14,%esp
801002d7:	5b                   	pop    %ebx
801002d8:	5d                   	pop    %ebp
801002d9:	c3                   	ret    

801002da <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
801002da:	55                   	push   %ebp
801002db:	89 e5                	mov    %esp,%ebp
801002dd:	83 ec 08             	sub    $0x8,%esp
801002e0:	8b 55 08             	mov    0x8(%ebp),%edx
801002e3:	8b 45 0c             	mov    0xc(%ebp),%eax
801002e6:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
801002ea:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
801002ed:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
801002f1:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
801002f5:	ee                   	out    %al,(%dx)
}
801002f6:	c9                   	leave  
801002f7:	c3                   	ret    

801002f8 <cli>:
  asm volatile("movw %0, %%gs" : : "r" (v));
}

static inline void
cli(void)
{
801002f8:	55                   	push   %ebp
801002f9:	89 e5                	mov    %esp,%ebp
  asm volatile("cli");
801002fb:	fa                   	cli    
}
801002fc:	5d                   	pop    %ebp
801002fd:	c3                   	ret    

801002fe <printint>:
  int locking;
} cons;

static void
printint(int xx, int base, int sign)
{
801002fe:	55                   	push   %ebp
801002ff:	89 e5                	mov    %esp,%ebp
80100301:	83 ec 48             	sub    $0x48,%esp
  static char digits[] = "0123456789ABCDEF";
  char buf[16];
  int i;
  uint x;

  if(sign && (sign = xx < 0))
80100304:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80100308:	74 19                	je     80100323 <printint+0x25>
8010030a:	8b 45 08             	mov    0x8(%ebp),%eax
8010030d:	c1 e8 1f             	shr    $0x1f,%eax
80100310:	89 45 10             	mov    %eax,0x10(%ebp)
80100313:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80100317:	74 0a                	je     80100323 <printint+0x25>
    x = -xx;
80100319:	8b 45 08             	mov    0x8(%ebp),%eax
8010031c:	f7 d8                	neg    %eax
8010031e:	89 45 f0             	mov    %eax,-0x10(%ebp)
80100321:	eb 06                	jmp    80100329 <printint+0x2b>
  else
    x = xx;
80100323:	8b 45 08             	mov    0x8(%ebp),%eax
80100326:	89 45 f0             	mov    %eax,-0x10(%ebp)

  i = 0;
80100329:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
  do{
    buf[i++] = digits[x % base];
80100330:	8b 4d 0c             	mov    0xc(%ebp),%ecx
80100333:	8b 45 f0             	mov    -0x10(%ebp),%eax
80100336:	ba 00 00 00 00       	mov    $0x0,%edx
8010033b:	f7 f1                	div    %ecx
8010033d:	89 d0                	mov    %edx,%eax
8010033f:	0f b6 90 04 a0 10 80 	movzbl -0x7fef5ffc(%eax),%edx
80100346:	8d 45 e0             	lea    -0x20(%ebp),%eax
80100349:	03 45 f4             	add    -0xc(%ebp),%eax
8010034c:	88 10                	mov    %dl,(%eax)
8010034e:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
  }while((x /= base) != 0);
80100352:	8b 55 0c             	mov    0xc(%ebp),%edx
80100355:	89 55 d4             	mov    %edx,-0x2c(%ebp)
80100358:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010035b:	ba 00 00 00 00       	mov    $0x0,%edx
80100360:	f7 75 d4             	divl   -0x2c(%ebp)
80100363:	89 45 f0             	mov    %eax,-0x10(%ebp)
80100366:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
8010036a:	75 c4                	jne    80100330 <printint+0x32>

  if(sign)
8010036c:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80100370:	74 23                	je     80100395 <printint+0x97>
    buf[i++] = '-';
80100372:	8d 45 e0             	lea    -0x20(%ebp),%eax
80100375:	03 45 f4             	add    -0xc(%ebp),%eax
80100378:	c6 00 2d             	movb   $0x2d,(%eax)
8010037b:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)

  while(--i >= 0)
8010037f:	eb 14                	jmp    80100395 <printint+0x97>
    consputc(buf[i]);
80100381:	8d 45 e0             	lea    -0x20(%ebp),%eax
80100384:	03 45 f4             	add    -0xc(%ebp),%eax
80100387:	0f b6 00             	movzbl (%eax),%eax
8010038a:	0f be c0             	movsbl %al,%eax
8010038d:	89 04 24             	mov    %eax,(%esp)
80100390:	e8 d3 03 00 00       	call   80100768 <consputc>
  }while((x /= base) != 0);

  if(sign)
    buf[i++] = '-';

  while(--i >= 0)
80100395:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
80100399:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010039d:	79 e2                	jns    80100381 <printint+0x83>
    consputc(buf[i]);
}
8010039f:	c9                   	leave  
801003a0:	c3                   	ret    

801003a1 <cprintf>:
//PAGEBREAK: 50

// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
801003a1:	55                   	push   %ebp
801003a2:	89 e5                	mov    %esp,%ebp
801003a4:	83 ec 38             	sub    $0x38,%esp
  int i, c, locking;
  uint *argp;
  char *s;

  locking = cons.locking;
801003a7:	a1 f4 c5 10 80       	mov    0x8010c5f4,%eax
801003ac:	89 45 e8             	mov    %eax,-0x18(%ebp)
  if(locking)
801003af:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
801003b3:	74 0c                	je     801003c1 <cprintf+0x20>
    acquire(&cons.lock);
801003b5:	c7 04 24 c0 c5 10 80 	movl   $0x8010c5c0,(%esp)
801003bc:	e8 8a 48 00 00       	call   80104c4b <acquire>

  if (fmt == 0)
801003c1:	8b 45 08             	mov    0x8(%ebp),%eax
801003c4:	85 c0                	test   %eax,%eax
801003c6:	75 0c                	jne    801003d4 <cprintf+0x33>
    panic("null fmt");
801003c8:	c7 04 24 a2 88 10 80 	movl   $0x801088a2,(%esp)
801003cf:	e8 81 01 00 00       	call   80100555 <panic>

  argp = (uint*)(void*)(&fmt + 1);
801003d4:	8d 45 0c             	lea    0xc(%ebp),%eax
801003d7:	89 45 f0             	mov    %eax,-0x10(%ebp)
  for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801003da:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801003e1:	e9 38 01 00 00       	jmp    8010051e <cprintf+0x17d>
    if(c != '%'){
801003e6:	83 7d e4 25          	cmpl   $0x25,-0x1c(%ebp)
801003ea:	74 10                	je     801003fc <cprintf+0x5b>
      consputc(c);
801003ec:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801003ef:	89 04 24             	mov    %eax,(%esp)
801003f2:	e8 71 03 00 00       	call   80100768 <consputc>
      continue;
801003f7:	e9 1e 01 00 00       	jmp    8010051a <cprintf+0x179>
    }
    c = fmt[++i] & 0xff;
801003fc:	8b 55 08             	mov    0x8(%ebp),%edx
801003ff:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80100403:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100406:	01 d0                	add    %edx,%eax
80100408:	0f b6 00             	movzbl (%eax),%eax
8010040b:	0f be c0             	movsbl %al,%eax
8010040e:	25 ff 00 00 00       	and    $0xff,%eax
80100413:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    if(c == 0)
80100416:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
8010041a:	0f 84 20 01 00 00    	je     80100540 <cprintf+0x19f>
      break;
    switch(c){
80100420:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100423:	83 f8 70             	cmp    $0x70,%eax
80100426:	74 65                	je     8010048d <cprintf+0xec>
80100428:	83 f8 70             	cmp    $0x70,%eax
8010042b:	7f 13                	jg     80100440 <cprintf+0x9f>
8010042d:	83 f8 25             	cmp    $0x25,%eax
80100430:	0f 84 be 00 00 00    	je     801004f4 <cprintf+0x153>
80100436:	83 f8 64             	cmp    $0x64,%eax
80100439:	74 14                	je     8010044f <cprintf+0xae>
8010043b:	e9 c2 00 00 00       	jmp    80100502 <cprintf+0x161>
80100440:	83 f8 73             	cmp    $0x73,%eax
80100443:	74 6b                	je     801004b0 <cprintf+0x10f>
80100445:	83 f8 78             	cmp    $0x78,%eax
80100448:	74 2b                	je     80100475 <cprintf+0xd4>
8010044a:	e9 b3 00 00 00       	jmp    80100502 <cprintf+0x161>
    case 'd':
      printint(*argp++, 10, 1);
8010044f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80100452:	8b 00                	mov    (%eax),%eax
80100454:	83 45 f0 04          	addl   $0x4,-0x10(%ebp)
80100458:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
8010045f:	00 
80100460:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
80100467:	00 
80100468:	89 04 24             	mov    %eax,(%esp)
8010046b:	e8 8e fe ff ff       	call   801002fe <printint>
      break;
80100470:	e9 a5 00 00 00       	jmp    8010051a <cprintf+0x179>
    case 'x':
      consputc('0');consputc('x');
80100475:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
8010047c:	e8 e7 02 00 00       	call   80100768 <consputc>
80100481:	c7 04 24 78 00 00 00 	movl   $0x78,(%esp)
80100488:	e8 db 02 00 00       	call   80100768 <consputc>
    case 'p':
      printint(*argp++, 16, 0);
8010048d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80100490:	8b 00                	mov    (%eax),%eax
80100492:	83 45 f0 04          	addl   $0x4,-0x10(%ebp)
80100496:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
8010049d:	00 
8010049e:	c7 44 24 04 10 00 00 	movl   $0x10,0x4(%esp)
801004a5:	00 
801004a6:	89 04 24             	mov    %eax,(%esp)
801004a9:	e8 50 fe ff ff       	call   801002fe <printint>
      break;
801004ae:	eb 6a                	jmp    8010051a <cprintf+0x179>
    case 's':
      if((s = (char*)*argp++) == 0)
801004b0:	8b 45 f0             	mov    -0x10(%ebp),%eax
801004b3:	8b 00                	mov    (%eax),%eax
801004b5:	89 45 ec             	mov    %eax,-0x14(%ebp)
801004b8:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
801004bc:	0f 94 c0             	sete   %al
801004bf:	83 45 f0 04          	addl   $0x4,-0x10(%ebp)
801004c3:	84 c0                	test   %al,%al
801004c5:	74 20                	je     801004e7 <cprintf+0x146>
        s = "(null)";
801004c7:	c7 45 ec ab 88 10 80 	movl   $0x801088ab,-0x14(%ebp)
      for(; *s; s++)
801004ce:	eb 17                	jmp    801004e7 <cprintf+0x146>
        consputc(*s);
801004d0:	8b 45 ec             	mov    -0x14(%ebp),%eax
801004d3:	0f b6 00             	movzbl (%eax),%eax
801004d6:	0f be c0             	movsbl %al,%eax
801004d9:	89 04 24             	mov    %eax,(%esp)
801004dc:	e8 87 02 00 00       	call   80100768 <consputc>
      printint(*argp++, 16, 0);
      break;
    case 's':
      if((s = (char*)*argp++) == 0)
        s = "(null)";
      for(; *s; s++)
801004e1:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
801004e5:	eb 01                	jmp    801004e8 <cprintf+0x147>
801004e7:	90                   	nop
801004e8:	8b 45 ec             	mov    -0x14(%ebp),%eax
801004eb:	0f b6 00             	movzbl (%eax),%eax
801004ee:	84 c0                	test   %al,%al
801004f0:	75 de                	jne    801004d0 <cprintf+0x12f>
        consputc(*s);
      break;
801004f2:	eb 26                	jmp    8010051a <cprintf+0x179>
    case '%':
      consputc('%');
801004f4:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
801004fb:	e8 68 02 00 00       	call   80100768 <consputc>
      break;
80100500:	eb 18                	jmp    8010051a <cprintf+0x179>
    default:
      // Print unknown % sequence to draw attention.
      consputc('%');
80100502:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
80100509:	e8 5a 02 00 00       	call   80100768 <consputc>
      consputc(c);
8010050e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100511:	89 04 24             	mov    %eax,(%esp)
80100514:	e8 4f 02 00 00       	call   80100768 <consputc>
      break;
80100519:	90                   	nop

  if (fmt == 0)
    panic("null fmt");

  argp = (uint*)(void*)(&fmt + 1);
  for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
8010051a:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010051e:	8b 55 08             	mov    0x8(%ebp),%edx
80100521:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100524:	01 d0                	add    %edx,%eax
80100526:	0f b6 00             	movzbl (%eax),%eax
80100529:	0f be c0             	movsbl %al,%eax
8010052c:	25 ff 00 00 00       	and    $0xff,%eax
80100531:	89 45 e4             	mov    %eax,-0x1c(%ebp)
80100534:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
80100538:	0f 85 a8 fe ff ff    	jne    801003e6 <cprintf+0x45>
8010053e:	eb 01                	jmp    80100541 <cprintf+0x1a0>
      consputc(c);
      continue;
    }
    c = fmt[++i] & 0xff;
    if(c == 0)
      break;
80100540:	90                   	nop
      consputc(c);
      break;
    }
  }

  if(locking)
80100541:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
80100545:	74 0c                	je     80100553 <cprintf+0x1b2>
    release(&cons.lock);
80100547:	c7 04 24 c0 c5 10 80 	movl   $0x8010c5c0,(%esp)
8010054e:	e8 5a 47 00 00       	call   80104cad <release>
}
80100553:	c9                   	leave  
80100554:	c3                   	ret    

80100555 <panic>:

void
panic(char *s)
{
80100555:	55                   	push   %ebp
80100556:	89 e5                	mov    %esp,%ebp
80100558:	83 ec 48             	sub    $0x48,%esp
  int i;
  uint pcs[10];

  cli();
8010055b:	e8 98 fd ff ff       	call   801002f8 <cli>
  cons.locking = 0;
80100560:	c7 05 f4 c5 10 80 00 	movl   $0x0,0x8010c5f4
80100567:	00 00 00 
  cprintf("cpu%d: panic: ", cpu->id);
8010056a:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80100570:	0f b6 00             	movzbl (%eax),%eax
80100573:	0f b6 c0             	movzbl %al,%eax
80100576:	89 44 24 04          	mov    %eax,0x4(%esp)
8010057a:	c7 04 24 b2 88 10 80 	movl   $0x801088b2,(%esp)
80100581:	e8 1b fe ff ff       	call   801003a1 <cprintf>
  cprintf(s);
80100586:	8b 45 08             	mov    0x8(%ebp),%eax
80100589:	89 04 24             	mov    %eax,(%esp)
8010058c:	e8 10 fe ff ff       	call   801003a1 <cprintf>
  cprintf("\n");
80100591:	c7 04 24 c1 88 10 80 	movl   $0x801088c1,(%esp)
80100598:	e8 04 fe ff ff       	call   801003a1 <cprintf>
  getcallerpcs(&s, pcs);
8010059d:	8d 45 cc             	lea    -0x34(%ebp),%eax
801005a0:	89 44 24 04          	mov    %eax,0x4(%esp)
801005a4:	8d 45 08             	lea    0x8(%ebp),%eax
801005a7:	89 04 24             	mov    %eax,(%esp)
801005aa:	e8 4d 47 00 00       	call   80104cfc <getcallerpcs>
  for(i=0; i<10; i++)
801005af:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801005b6:	eb 1b                	jmp    801005d3 <panic+0x7e>
    cprintf(" %p", pcs[i]);
801005b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801005bb:	8b 44 85 cc          	mov    -0x34(%ebp,%eax,4),%eax
801005bf:	89 44 24 04          	mov    %eax,0x4(%esp)
801005c3:	c7 04 24 c3 88 10 80 	movl   $0x801088c3,(%esp)
801005ca:	e8 d2 fd ff ff       	call   801003a1 <cprintf>
  cons.locking = 0;
  cprintf("cpu%d: panic: ", cpu->id);
  cprintf(s);
  cprintf("\n");
  getcallerpcs(&s, pcs);
  for(i=0; i<10; i++)
801005cf:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801005d3:	83 7d f4 09          	cmpl   $0x9,-0xc(%ebp)
801005d7:	7e df                	jle    801005b8 <panic+0x63>
    cprintf(" %p", pcs[i]);
  panicked = 1; // freeze other CPU
801005d9:	c7 05 a0 c5 10 80 01 	movl   $0x1,0x8010c5a0
801005e0:	00 00 00 
  for(;;)
    ;
801005e3:	eb fe                	jmp    801005e3 <panic+0x8e>

801005e5 <cgaputc>:
#define CRTPORT 0x3d4
static ushort *crt = (ushort*)P2V(0xb8000);  // CGA memory

static void
cgaputc(int c)
{
801005e5:	55                   	push   %ebp
801005e6:	89 e5                	mov    %esp,%ebp
801005e8:	83 ec 28             	sub    $0x28,%esp
  int pos;

  // Cursor position: col + 80*row.
  outb(CRTPORT, 14);
801005eb:	c7 44 24 04 0e 00 00 	movl   $0xe,0x4(%esp)
801005f2:	00 
801005f3:	c7 04 24 d4 03 00 00 	movl   $0x3d4,(%esp)
801005fa:	e8 db fc ff ff       	call   801002da <outb>
  pos = inb(CRTPORT+1) << 8;
801005ff:	c7 04 24 d5 03 00 00 	movl   $0x3d5,(%esp)
80100606:	e8 a5 fc ff ff       	call   801002b0 <inb>
8010060b:	0f b6 c0             	movzbl %al,%eax
8010060e:	c1 e0 08             	shl    $0x8,%eax
80100611:	89 45 f4             	mov    %eax,-0xc(%ebp)
  outb(CRTPORT, 15);
80100614:	c7 44 24 04 0f 00 00 	movl   $0xf,0x4(%esp)
8010061b:	00 
8010061c:	c7 04 24 d4 03 00 00 	movl   $0x3d4,(%esp)
80100623:	e8 b2 fc ff ff       	call   801002da <outb>
  pos |= inb(CRTPORT+1);
80100628:	c7 04 24 d5 03 00 00 	movl   $0x3d5,(%esp)
8010062f:	e8 7c fc ff ff       	call   801002b0 <inb>
80100634:	0f b6 c0             	movzbl %al,%eax
80100637:	09 45 f4             	or     %eax,-0xc(%ebp)

  if(c == '\n')
8010063a:	83 7d 08 0a          	cmpl   $0xa,0x8(%ebp)
8010063e:	75 30                	jne    80100670 <cgaputc+0x8b>
    pos += 80 - pos%80;
80100640:	8b 4d f4             	mov    -0xc(%ebp),%ecx
80100643:	ba 67 66 66 66       	mov    $0x66666667,%edx
80100648:	89 c8                	mov    %ecx,%eax
8010064a:	f7 ea                	imul   %edx
8010064c:	c1 fa 05             	sar    $0x5,%edx
8010064f:	89 c8                	mov    %ecx,%eax
80100651:	c1 f8 1f             	sar    $0x1f,%eax
80100654:	29 c2                	sub    %eax,%edx
80100656:	89 d0                	mov    %edx,%eax
80100658:	c1 e0 02             	shl    $0x2,%eax
8010065b:	01 d0                	add    %edx,%eax
8010065d:	c1 e0 04             	shl    $0x4,%eax
80100660:	89 ca                	mov    %ecx,%edx
80100662:	29 c2                	sub    %eax,%edx
80100664:	b8 50 00 00 00       	mov    $0x50,%eax
80100669:	29 d0                	sub    %edx,%eax
8010066b:	01 45 f4             	add    %eax,-0xc(%ebp)
8010066e:	eb 32                	jmp    801006a2 <cgaputc+0xbd>
  else if(c == BACKSPACE){
80100670:	81 7d 08 00 01 00 00 	cmpl   $0x100,0x8(%ebp)
80100677:	75 0c                	jne    80100685 <cgaputc+0xa0>
    if(pos > 0) --pos;
80100679:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010067d:	7e 23                	jle    801006a2 <cgaputc+0xbd>
8010067f:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
80100683:	eb 1d                	jmp    801006a2 <cgaputc+0xbd>
  } else
    crt[pos++] = (c&0xff) | 0x0700;  // black on white
80100685:	a1 00 a0 10 80       	mov    0x8010a000,%eax
8010068a:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010068d:	01 d2                	add    %edx,%edx
8010068f:	01 c2                	add    %eax,%edx
80100691:	8b 45 08             	mov    0x8(%ebp),%eax
80100694:	66 25 ff 00          	and    $0xff,%ax
80100698:	80 cc 07             	or     $0x7,%ah
8010069b:	66 89 02             	mov    %ax,(%edx)
8010069e:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)

  if((pos/80) >= 24){  // Scroll up.
801006a2:	81 7d f4 7f 07 00 00 	cmpl   $0x77f,-0xc(%ebp)
801006a9:	7e 53                	jle    801006fe <cgaputc+0x119>
    memmove(crt, crt+80, sizeof(crt[0])*23*80);
801006ab:	a1 00 a0 10 80       	mov    0x8010a000,%eax
801006b0:	8d 90 a0 00 00 00    	lea    0xa0(%eax),%edx
801006b6:	a1 00 a0 10 80       	mov    0x8010a000,%eax
801006bb:	c7 44 24 08 60 0e 00 	movl   $0xe60,0x8(%esp)
801006c2:	00 
801006c3:	89 54 24 04          	mov    %edx,0x4(%esp)
801006c7:	89 04 24             	mov    %eax,(%esp)
801006ca:	e8 9e 48 00 00       	call   80104f6d <memmove>
    pos -= 80;
801006cf:	83 6d f4 50          	subl   $0x50,-0xc(%ebp)
    memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
801006d3:	b8 80 07 00 00       	mov    $0x780,%eax
801006d8:	2b 45 f4             	sub    -0xc(%ebp),%eax
801006db:	01 c0                	add    %eax,%eax
801006dd:	8b 15 00 a0 10 80    	mov    0x8010a000,%edx
801006e3:	8b 4d f4             	mov    -0xc(%ebp),%ecx
801006e6:	01 c9                	add    %ecx,%ecx
801006e8:	01 ca                	add    %ecx,%edx
801006ea:	89 44 24 08          	mov    %eax,0x8(%esp)
801006ee:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801006f5:	00 
801006f6:	89 14 24             	mov    %edx,(%esp)
801006f9:	e8 9c 47 00 00       	call   80104e9a <memset>
  }

  outb(CRTPORT, 14);
801006fe:	c7 44 24 04 0e 00 00 	movl   $0xe,0x4(%esp)
80100705:	00 
80100706:	c7 04 24 d4 03 00 00 	movl   $0x3d4,(%esp)
8010070d:	e8 c8 fb ff ff       	call   801002da <outb>
  outb(CRTPORT+1, pos>>8);
80100712:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100715:	c1 f8 08             	sar    $0x8,%eax
80100718:	0f b6 c0             	movzbl %al,%eax
8010071b:	89 44 24 04          	mov    %eax,0x4(%esp)
8010071f:	c7 04 24 d5 03 00 00 	movl   $0x3d5,(%esp)
80100726:	e8 af fb ff ff       	call   801002da <outb>
  outb(CRTPORT, 15);
8010072b:	c7 44 24 04 0f 00 00 	movl   $0xf,0x4(%esp)
80100732:	00 
80100733:	c7 04 24 d4 03 00 00 	movl   $0x3d4,(%esp)
8010073a:	e8 9b fb ff ff       	call   801002da <outb>
  outb(CRTPORT+1, pos);
8010073f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100742:	0f b6 c0             	movzbl %al,%eax
80100745:	89 44 24 04          	mov    %eax,0x4(%esp)
80100749:	c7 04 24 d5 03 00 00 	movl   $0x3d5,(%esp)
80100750:	e8 85 fb ff ff       	call   801002da <outb>
  crt[pos] = ' ' | 0x0700;
80100755:	a1 00 a0 10 80       	mov    0x8010a000,%eax
8010075a:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010075d:	01 d2                	add    %edx,%edx
8010075f:	01 d0                	add    %edx,%eax
80100761:	66 c7 00 20 07       	movw   $0x720,(%eax)
}
80100766:	c9                   	leave  
80100767:	c3                   	ret    

80100768 <consputc>:

void
consputc(int c)
{
80100768:	55                   	push   %ebp
80100769:	89 e5                	mov    %esp,%ebp
8010076b:	83 ec 18             	sub    $0x18,%esp
  if(panicked){
8010076e:	a1 a0 c5 10 80       	mov    0x8010c5a0,%eax
80100773:	85 c0                	test   %eax,%eax
80100775:	74 07                	je     8010077e <consputc+0x16>
    cli();
80100777:	e8 7c fb ff ff       	call   801002f8 <cli>
    for(;;)
      ;
8010077c:	eb fe                	jmp    8010077c <consputc+0x14>
  }

  if(c == BACKSPACE){
8010077e:	81 7d 08 00 01 00 00 	cmpl   $0x100,0x8(%ebp)
80100785:	75 26                	jne    801007ad <consputc+0x45>
    uartputc('\b'); uartputc(' '); uartputc('\b');
80100787:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
8010078e:	e8 e6 60 00 00       	call   80106879 <uartputc>
80100793:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
8010079a:	e8 da 60 00 00       	call   80106879 <uartputc>
8010079f:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
801007a6:	e8 ce 60 00 00       	call   80106879 <uartputc>
801007ab:	eb 0b                	jmp    801007b8 <consputc+0x50>
  } else
    uartputc(c);
801007ad:	8b 45 08             	mov    0x8(%ebp),%eax
801007b0:	89 04 24             	mov    %eax,(%esp)
801007b3:	e8 c1 60 00 00       	call   80106879 <uartputc>
  cgaputc(c);
801007b8:	8b 45 08             	mov    0x8(%ebp),%eax
801007bb:	89 04 24             	mov    %eax,(%esp)
801007be:	e8 22 fe ff ff       	call   801005e5 <cgaputc>
}
801007c3:	c9                   	leave  
801007c4:	c3                   	ret    

801007c5 <consoleintr>:

#define C(x)  ((x)-'@')  // Control-x

void
consoleintr(int (*getc)(void))
{
801007c5:	55                   	push   %ebp
801007c6:	89 e5                	mov    %esp,%ebp
801007c8:	83 ec 28             	sub    $0x28,%esp
  int c;

  acquire(&input.lock);
801007cb:	c7 04 24 a0 ed 10 80 	movl   $0x8010eda0,(%esp)
801007d2:	e8 74 44 00 00       	call   80104c4b <acquire>
  while((c = getc()) >= 0){
801007d7:	e9 41 01 00 00       	jmp    8010091d <consoleintr+0x158>
    switch(c){
801007dc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801007df:	83 f8 10             	cmp    $0x10,%eax
801007e2:	74 1e                	je     80100802 <consoleintr+0x3d>
801007e4:	83 f8 10             	cmp    $0x10,%eax
801007e7:	7f 0a                	jg     801007f3 <consoleintr+0x2e>
801007e9:	83 f8 08             	cmp    $0x8,%eax
801007ec:	74 68                	je     80100856 <consoleintr+0x91>
801007ee:	e9 94 00 00 00       	jmp    80100887 <consoleintr+0xc2>
801007f3:	83 f8 15             	cmp    $0x15,%eax
801007f6:	74 2f                	je     80100827 <consoleintr+0x62>
801007f8:	83 f8 7f             	cmp    $0x7f,%eax
801007fb:	74 59                	je     80100856 <consoleintr+0x91>
801007fd:	e9 85 00 00 00       	jmp    80100887 <consoleintr+0xc2>
    case C('P'):  // Process listing.
      procdump();
80100802:	e8 fe 42 00 00       	call   80104b05 <procdump>
      break;
80100807:	e9 11 01 00 00       	jmp    8010091d <consoleintr+0x158>
    case C('U'):  // Kill line.
      while(input.e != input.w &&
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
        input.e--;
8010080c:	a1 5c ee 10 80       	mov    0x8010ee5c,%eax
80100811:	83 e8 01             	sub    $0x1,%eax
80100814:	a3 5c ee 10 80       	mov    %eax,0x8010ee5c
        consputc(BACKSPACE);
80100819:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
80100820:	e8 43 ff ff ff       	call   80100768 <consputc>
80100825:	eb 01                	jmp    80100828 <consoleintr+0x63>
    switch(c){
    case C('P'):  // Process listing.
      procdump();
      break;
    case C('U'):  // Kill line.
      while(input.e != input.w &&
80100827:	90                   	nop
80100828:	8b 15 5c ee 10 80    	mov    0x8010ee5c,%edx
8010082e:	a1 58 ee 10 80       	mov    0x8010ee58,%eax
80100833:	39 c2                	cmp    %eax,%edx
80100835:	0f 84 db 00 00 00    	je     80100916 <consoleintr+0x151>
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
8010083b:	a1 5c ee 10 80       	mov    0x8010ee5c,%eax
80100840:	83 e8 01             	sub    $0x1,%eax
80100843:	83 e0 7f             	and    $0x7f,%eax
80100846:	0f b6 80 d4 ed 10 80 	movzbl -0x7fef122c(%eax),%eax
    switch(c){
    case C('P'):  // Process listing.
      procdump();
      break;
    case C('U'):  // Kill line.
      while(input.e != input.w &&
8010084d:	3c 0a                	cmp    $0xa,%al
8010084f:	75 bb                	jne    8010080c <consoleintr+0x47>
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
        input.e--;
        consputc(BACKSPACE);
      }
      break;
80100851:	e9 c0 00 00 00       	jmp    80100916 <consoleintr+0x151>
    case C('H'): case '\x7f':  // Backspace
      if(input.e != input.w){
80100856:	8b 15 5c ee 10 80    	mov    0x8010ee5c,%edx
8010085c:	a1 58 ee 10 80       	mov    0x8010ee58,%eax
80100861:	39 c2                	cmp    %eax,%edx
80100863:	0f 84 b0 00 00 00    	je     80100919 <consoleintr+0x154>
        input.e--;
80100869:	a1 5c ee 10 80       	mov    0x8010ee5c,%eax
8010086e:	83 e8 01             	sub    $0x1,%eax
80100871:	a3 5c ee 10 80       	mov    %eax,0x8010ee5c
        consputc(BACKSPACE);
80100876:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
8010087d:	e8 e6 fe ff ff       	call   80100768 <consputc>
      }
      break;
80100882:	e9 92 00 00 00       	jmp    80100919 <consoleintr+0x154>
    default:
      if(c != 0 && input.e-input.r < INPUT_BUF){
80100887:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010088b:	0f 84 8b 00 00 00    	je     8010091c <consoleintr+0x157>
80100891:	8b 15 5c ee 10 80    	mov    0x8010ee5c,%edx
80100897:	a1 54 ee 10 80       	mov    0x8010ee54,%eax
8010089c:	89 d1                	mov    %edx,%ecx
8010089e:	29 c1                	sub    %eax,%ecx
801008a0:	89 c8                	mov    %ecx,%eax
801008a2:	83 f8 7f             	cmp    $0x7f,%eax
801008a5:	77 75                	ja     8010091c <consoleintr+0x157>
        c = (c == '\r') ? '\n' : c;
801008a7:	83 7d f4 0d          	cmpl   $0xd,-0xc(%ebp)
801008ab:	74 05                	je     801008b2 <consoleintr+0xed>
801008ad:	8b 45 f4             	mov    -0xc(%ebp),%eax
801008b0:	eb 05                	jmp    801008b7 <consoleintr+0xf2>
801008b2:	b8 0a 00 00 00       	mov    $0xa,%eax
801008b7:	89 45 f4             	mov    %eax,-0xc(%ebp)
        input.buf[input.e++ % INPUT_BUF] = c;
801008ba:	a1 5c ee 10 80       	mov    0x8010ee5c,%eax
801008bf:	89 c1                	mov    %eax,%ecx
801008c1:	83 e1 7f             	and    $0x7f,%ecx
801008c4:	8b 55 f4             	mov    -0xc(%ebp),%edx
801008c7:	88 91 d4 ed 10 80    	mov    %dl,-0x7fef122c(%ecx)
801008cd:	83 c0 01             	add    $0x1,%eax
801008d0:	a3 5c ee 10 80       	mov    %eax,0x8010ee5c
        consputc(c);
801008d5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801008d8:	89 04 24             	mov    %eax,(%esp)
801008db:	e8 88 fe ff ff       	call   80100768 <consputc>
        if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
801008e0:	83 7d f4 0a          	cmpl   $0xa,-0xc(%ebp)
801008e4:	74 18                	je     801008fe <consoleintr+0x139>
801008e6:	83 7d f4 04          	cmpl   $0x4,-0xc(%ebp)
801008ea:	74 12                	je     801008fe <consoleintr+0x139>
801008ec:	a1 5c ee 10 80       	mov    0x8010ee5c,%eax
801008f1:	8b 15 54 ee 10 80    	mov    0x8010ee54,%edx
801008f7:	83 ea 80             	sub    $0xffffff80,%edx
801008fa:	39 d0                	cmp    %edx,%eax
801008fc:	75 1e                	jne    8010091c <consoleintr+0x157>
          input.w = input.e;
801008fe:	a1 5c ee 10 80       	mov    0x8010ee5c,%eax
80100903:	a3 58 ee 10 80       	mov    %eax,0x8010ee58
          wakeup(&input.r);
80100908:	c7 04 24 54 ee 10 80 	movl   $0x8010ee54,(%esp)
8010090f:	e8 4e 41 00 00       	call   80104a62 <wakeup>
        }
      }
      break;
80100914:	eb 06                	jmp    8010091c <consoleintr+0x157>
      while(input.e != input.w &&
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
        input.e--;
        consputc(BACKSPACE);
      }
      break;
80100916:	90                   	nop
80100917:	eb 04                	jmp    8010091d <consoleintr+0x158>
    case C('H'): case '\x7f':  // Backspace
      if(input.e != input.w){
        input.e--;
        consputc(BACKSPACE);
      }
      break;
80100919:	90                   	nop
8010091a:	eb 01                	jmp    8010091d <consoleintr+0x158>
        if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
          input.w = input.e;
          wakeup(&input.r);
        }
      }
      break;
8010091c:	90                   	nop
consoleintr(int (*getc)(void))
{
  int c;

  acquire(&input.lock);
  while((c = getc()) >= 0){
8010091d:	8b 45 08             	mov    0x8(%ebp),%eax
80100920:	ff d0                	call   *%eax
80100922:	89 45 f4             	mov    %eax,-0xc(%ebp)
80100925:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80100929:	0f 89 ad fe ff ff    	jns    801007dc <consoleintr+0x17>
        }
      }
      break;
    }
  }
  release(&input.lock);
8010092f:	c7 04 24 a0 ed 10 80 	movl   $0x8010eda0,(%esp)
80100936:	e8 72 43 00 00       	call   80104cad <release>
}
8010093b:	c9                   	leave  
8010093c:	c3                   	ret    

8010093d <consoleread>:

int
consoleread(struct inode *ip, char *dst, int n)
{
8010093d:	55                   	push   %ebp
8010093e:	89 e5                	mov    %esp,%ebp
80100940:	83 ec 28             	sub    $0x28,%esp
  uint target;
  int c;

  iunlock(ip);
80100943:	8b 45 08             	mov    0x8(%ebp),%eax
80100946:	89 04 24             	mov    %eax,(%esp)
80100949:	e8 78 10 00 00       	call   801019c6 <iunlock>
  target = n;
8010094e:	8b 45 10             	mov    0x10(%ebp),%eax
80100951:	89 45 f4             	mov    %eax,-0xc(%ebp)
  acquire(&input.lock);
80100954:	c7 04 24 a0 ed 10 80 	movl   $0x8010eda0,(%esp)
8010095b:	e8 eb 42 00 00       	call   80104c4b <acquire>
  while(n > 0){
80100960:	e9 a8 00 00 00       	jmp    80100a0d <consoleread+0xd0>
    while(input.r == input.w){
      if(proc->killed){
80100965:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010096b:	8b 40 24             	mov    0x24(%eax),%eax
8010096e:	85 c0                	test   %eax,%eax
80100970:	74 21                	je     80100993 <consoleread+0x56>
        release(&input.lock);
80100972:	c7 04 24 a0 ed 10 80 	movl   $0x8010eda0,(%esp)
80100979:	e8 2f 43 00 00       	call   80104cad <release>
        ilock(ip);
8010097e:	8b 45 08             	mov    0x8(%ebp),%eax
80100981:	89 04 24             	mov    %eax,(%esp)
80100984:	e8 ef 0e 00 00       	call   80101878 <ilock>
        return -1;
80100989:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010098e:	e9 a9 00 00 00       	jmp    80100a3c <consoleread+0xff>
      }
      sleep(&input.r, &input.lock);
80100993:	c7 44 24 04 a0 ed 10 	movl   $0x8010eda0,0x4(%esp)
8010099a:	80 
8010099b:	c7 04 24 54 ee 10 80 	movl   $0x8010ee54,(%esp)
801009a2:	e8 e2 3f 00 00       	call   80104989 <sleep>
801009a7:	eb 01                	jmp    801009aa <consoleread+0x6d>

  iunlock(ip);
  target = n;
  acquire(&input.lock);
  while(n > 0){
    while(input.r == input.w){
801009a9:	90                   	nop
801009aa:	8b 15 54 ee 10 80    	mov    0x8010ee54,%edx
801009b0:	a1 58 ee 10 80       	mov    0x8010ee58,%eax
801009b5:	39 c2                	cmp    %eax,%edx
801009b7:	74 ac                	je     80100965 <consoleread+0x28>
        ilock(ip);
        return -1;
      }
      sleep(&input.r, &input.lock);
    }
    c = input.buf[input.r++ % INPUT_BUF];
801009b9:	a1 54 ee 10 80       	mov    0x8010ee54,%eax
801009be:	89 c2                	mov    %eax,%edx
801009c0:	83 e2 7f             	and    $0x7f,%edx
801009c3:	0f b6 92 d4 ed 10 80 	movzbl -0x7fef122c(%edx),%edx
801009ca:	0f be d2             	movsbl %dl,%edx
801009cd:	89 55 f0             	mov    %edx,-0x10(%ebp)
801009d0:	83 c0 01             	add    $0x1,%eax
801009d3:	a3 54 ee 10 80       	mov    %eax,0x8010ee54
    if(c == C('D')){  // EOF
801009d8:	83 7d f0 04          	cmpl   $0x4,-0x10(%ebp)
801009dc:	75 17                	jne    801009f5 <consoleread+0xb8>
      if(n < target){
801009de:	8b 45 10             	mov    0x10(%ebp),%eax
801009e1:	3b 45 f4             	cmp    -0xc(%ebp),%eax
801009e4:	73 2f                	jae    80100a15 <consoleread+0xd8>
        // Save ^D for next time, to make sure
        // caller gets a 0-byte result.
        input.r--;
801009e6:	a1 54 ee 10 80       	mov    0x8010ee54,%eax
801009eb:	83 e8 01             	sub    $0x1,%eax
801009ee:	a3 54 ee 10 80       	mov    %eax,0x8010ee54
      }
      break;
801009f3:	eb 20                	jmp    80100a15 <consoleread+0xd8>
    }
    *dst++ = c;
801009f5:	8b 45 f0             	mov    -0x10(%ebp),%eax
801009f8:	89 c2                	mov    %eax,%edx
801009fa:	8b 45 0c             	mov    0xc(%ebp),%eax
801009fd:	88 10                	mov    %dl,(%eax)
801009ff:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
    --n;
80100a03:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
    if(c == '\n')
80100a07:	83 7d f0 0a          	cmpl   $0xa,-0x10(%ebp)
80100a0b:	74 0b                	je     80100a18 <consoleread+0xdb>
  int c;

  iunlock(ip);
  target = n;
  acquire(&input.lock);
  while(n > 0){
80100a0d:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80100a11:	7f 96                	jg     801009a9 <consoleread+0x6c>
80100a13:	eb 04                	jmp    80100a19 <consoleread+0xdc>
      if(n < target){
        // Save ^D for next time, to make sure
        // caller gets a 0-byte result.
        input.r--;
      }
      break;
80100a15:	90                   	nop
80100a16:	eb 01                	jmp    80100a19 <consoleread+0xdc>
    }
    *dst++ = c;
    --n;
    if(c == '\n')
      break;
80100a18:	90                   	nop
  }
  release(&input.lock);
80100a19:	c7 04 24 a0 ed 10 80 	movl   $0x8010eda0,(%esp)
80100a20:	e8 88 42 00 00       	call   80104cad <release>
  ilock(ip);
80100a25:	8b 45 08             	mov    0x8(%ebp),%eax
80100a28:	89 04 24             	mov    %eax,(%esp)
80100a2b:	e8 48 0e 00 00       	call   80101878 <ilock>

  return target - n;
80100a30:	8b 45 10             	mov    0x10(%ebp),%eax
80100a33:	8b 55 f4             	mov    -0xc(%ebp),%edx
80100a36:	89 d1                	mov    %edx,%ecx
80100a38:	29 c1                	sub    %eax,%ecx
80100a3a:	89 c8                	mov    %ecx,%eax
}
80100a3c:	c9                   	leave  
80100a3d:	c3                   	ret    

80100a3e <consolewrite>:

int
consolewrite(struct inode *ip, char *buf, int n)
{
80100a3e:	55                   	push   %ebp
80100a3f:	89 e5                	mov    %esp,%ebp
80100a41:	83 ec 28             	sub    $0x28,%esp
  int i;

  iunlock(ip);
80100a44:	8b 45 08             	mov    0x8(%ebp),%eax
80100a47:	89 04 24             	mov    %eax,(%esp)
80100a4a:	e8 77 0f 00 00       	call   801019c6 <iunlock>
  acquire(&cons.lock);
80100a4f:	c7 04 24 c0 c5 10 80 	movl   $0x8010c5c0,(%esp)
80100a56:	e8 f0 41 00 00       	call   80104c4b <acquire>
  for(i = 0; i < n; i++)
80100a5b:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80100a62:	eb 1d                	jmp    80100a81 <consolewrite+0x43>
    consputc(buf[i] & 0xff);
80100a64:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100a67:	03 45 0c             	add    0xc(%ebp),%eax
80100a6a:	0f b6 00             	movzbl (%eax),%eax
80100a6d:	0f be c0             	movsbl %al,%eax
80100a70:	25 ff 00 00 00       	and    $0xff,%eax
80100a75:	89 04 24             	mov    %eax,(%esp)
80100a78:	e8 eb fc ff ff       	call   80100768 <consputc>
{
  int i;

  iunlock(ip);
  acquire(&cons.lock);
  for(i = 0; i < n; i++)
80100a7d:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80100a81:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100a84:	3b 45 10             	cmp    0x10(%ebp),%eax
80100a87:	7c db                	jl     80100a64 <consolewrite+0x26>
    consputc(buf[i] & 0xff);
  release(&cons.lock);
80100a89:	c7 04 24 c0 c5 10 80 	movl   $0x8010c5c0,(%esp)
80100a90:	e8 18 42 00 00       	call   80104cad <release>
  ilock(ip);
80100a95:	8b 45 08             	mov    0x8(%ebp),%eax
80100a98:	89 04 24             	mov    %eax,(%esp)
80100a9b:	e8 d8 0d 00 00       	call   80101878 <ilock>

  return n;
80100aa0:	8b 45 10             	mov    0x10(%ebp),%eax
}
80100aa3:	c9                   	leave  
80100aa4:	c3                   	ret    

80100aa5 <consoleinit>:

void
consoleinit(void)
{
80100aa5:	55                   	push   %ebp
80100aa6:	89 e5                	mov    %esp,%ebp
80100aa8:	83 ec 18             	sub    $0x18,%esp
  initlock(&cons.lock, "console");
80100aab:	c7 44 24 04 c7 88 10 	movl   $0x801088c7,0x4(%esp)
80100ab2:	80 
80100ab3:	c7 04 24 c0 c5 10 80 	movl   $0x8010c5c0,(%esp)
80100aba:	e8 6b 41 00 00       	call   80104c2a <initlock>
  initlock(&input.lock, "input");
80100abf:	c7 44 24 04 cf 88 10 	movl   $0x801088cf,0x4(%esp)
80100ac6:	80 
80100ac7:	c7 04 24 a0 ed 10 80 	movl   $0x8010eda0,(%esp)
80100ace:	e8 57 41 00 00       	call   80104c2a <initlock>

  devsw[CONSOLE].write = consolewrite;
80100ad3:	c7 05 0c f8 10 80 3e 	movl   $0x80100a3e,0x8010f80c
80100ada:	0a 10 80 
  devsw[CONSOLE].read = consoleread;
80100add:	c7 05 08 f8 10 80 3d 	movl   $0x8010093d,0x8010f808
80100ae4:	09 10 80 
  cons.locking = 1;
80100ae7:	c7 05 f4 c5 10 80 01 	movl   $0x1,0x8010c5f4
80100aee:	00 00 00 

  picenable(IRQ_KBD);
80100af1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80100af8:	e8 04 31 00 00       	call   80103c01 <picenable>
  ioapicenable(IRQ_KBD, 0);
80100afd:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80100b04:	00 
80100b05:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80100b0c:	e8 75 1e 00 00       	call   80102986 <ioapicenable>
}
80100b11:	c9                   	leave  
80100b12:	c3                   	ret    
	...

80100b14 <exec>:
#include "x86.h"
#include "elf.h"

int
exec(char *path, char **argv)
{
80100b14:	55                   	push   %ebp
80100b15:	89 e5                	mov    %esp,%ebp
80100b17:	81 ec 38 01 00 00    	sub    $0x138,%esp
  struct elfhdr elf;
  struct inode *ip;
  struct proghdr ph;
  pde_t *pgdir, *oldpgdir;

  if((ip = namei(path)) == 0)
80100b1d:	8b 45 08             	mov    0x8(%ebp),%eax
80100b20:	89 04 24             	mov    %eax,(%esp)
80100b23:	e8 f2 18 00 00       	call   8010241a <namei>
80100b28:	89 45 d8             	mov    %eax,-0x28(%ebp)
80100b2b:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
80100b2f:	75 0a                	jne    80100b3b <exec+0x27>
    return -1;
80100b31:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80100b36:	e9 d3 03 00 00       	jmp    80100f0e <exec+0x3fa>
  ilock(ip);
80100b3b:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100b3e:	89 04 24             	mov    %eax,(%esp)
80100b41:	e8 32 0d 00 00       	call   80101878 <ilock>
  pgdir = 0;
80100b46:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)

  // Check ELF header
  if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
80100b4d:	c7 44 24 0c 34 00 00 	movl   $0x34,0xc(%esp)
80100b54:	00 
80100b55:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80100b5c:	00 
80100b5d:	8d 85 0c ff ff ff    	lea    -0xf4(%ebp),%eax
80100b63:	89 44 24 04          	mov    %eax,0x4(%esp)
80100b67:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100b6a:	89 04 24             	mov    %eax,(%esp)
80100b6d:	e8 fc 11 00 00       	call   80101d6e <readi>
80100b72:	83 f8 33             	cmp    $0x33,%eax
80100b75:	0f 86 4d 03 00 00    	jbe    80100ec8 <exec+0x3b4>
    goto bad;
  if(elf.magic != ELF_MAGIC)
80100b7b:	8b 85 0c ff ff ff    	mov    -0xf4(%ebp),%eax
80100b81:	3d 7f 45 4c 46       	cmp    $0x464c457f,%eax
80100b86:	0f 85 3f 03 00 00    	jne    80100ecb <exec+0x3b7>
    goto bad;

  if((pgdir = setupkvm()) == 0)
80100b8c:	e8 f5 6e 00 00       	call   80107a86 <setupkvm>
80100b91:	89 45 d4             	mov    %eax,-0x2c(%ebp)
80100b94:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
80100b98:	0f 84 30 03 00 00    	je     80100ece <exec+0x3ba>
    goto bad;

  // Load program into memory.
  sz = 0;
80100b9e:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100ba5:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
80100bac:	8b 85 28 ff ff ff    	mov    -0xd8(%ebp),%eax
80100bb2:	89 45 e8             	mov    %eax,-0x18(%ebp)
80100bb5:	e9 c5 00 00 00       	jmp    80100c7f <exec+0x16b>
    if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
80100bba:	8b 45 e8             	mov    -0x18(%ebp),%eax
80100bbd:	c7 44 24 0c 20 00 00 	movl   $0x20,0xc(%esp)
80100bc4:	00 
80100bc5:	89 44 24 08          	mov    %eax,0x8(%esp)
80100bc9:	8d 85 ec fe ff ff    	lea    -0x114(%ebp),%eax
80100bcf:	89 44 24 04          	mov    %eax,0x4(%esp)
80100bd3:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100bd6:	89 04 24             	mov    %eax,(%esp)
80100bd9:	e8 90 11 00 00       	call   80101d6e <readi>
80100bde:	83 f8 20             	cmp    $0x20,%eax
80100be1:	0f 85 ea 02 00 00    	jne    80100ed1 <exec+0x3bd>
      goto bad;
    if(ph.type != ELF_PROG_LOAD)
80100be7:	8b 85 ec fe ff ff    	mov    -0x114(%ebp),%eax
80100bed:	83 f8 01             	cmp    $0x1,%eax
80100bf0:	75 7f                	jne    80100c71 <exec+0x15d>
      continue;
    if(ph.memsz < ph.filesz)
80100bf2:	8b 95 00 ff ff ff    	mov    -0x100(%ebp),%edx
80100bf8:	8b 85 fc fe ff ff    	mov    -0x104(%ebp),%eax
80100bfe:	39 c2                	cmp    %eax,%edx
80100c00:	0f 82 ce 02 00 00    	jb     80100ed4 <exec+0x3c0>
      goto bad;
    if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
80100c06:	8b 95 f4 fe ff ff    	mov    -0x10c(%ebp),%edx
80100c0c:	8b 85 00 ff ff ff    	mov    -0x100(%ebp),%eax
80100c12:	01 d0                	add    %edx,%eax
80100c14:	89 44 24 08          	mov    %eax,0x8(%esp)
80100c18:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100c1b:	89 44 24 04          	mov    %eax,0x4(%esp)
80100c1f:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100c22:	89 04 24             	mov    %eax,(%esp)
80100c25:	e8 59 72 00 00       	call   80107e83 <allocuvm>
80100c2a:	89 45 e0             	mov    %eax,-0x20(%ebp)
80100c2d:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
80100c31:	0f 84 a0 02 00 00    	je     80100ed7 <exec+0x3c3>
      goto bad;
    if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
80100c37:	8b 8d fc fe ff ff    	mov    -0x104(%ebp),%ecx
80100c3d:	8b 95 f0 fe ff ff    	mov    -0x110(%ebp),%edx
80100c43:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
80100c49:	89 4c 24 10          	mov    %ecx,0x10(%esp)
80100c4d:	89 54 24 0c          	mov    %edx,0xc(%esp)
80100c51:	8b 55 d8             	mov    -0x28(%ebp),%edx
80100c54:	89 54 24 08          	mov    %edx,0x8(%esp)
80100c58:	89 44 24 04          	mov    %eax,0x4(%esp)
80100c5c:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100c5f:	89 04 24             	mov    %eax,(%esp)
80100c62:	e8 2d 71 00 00       	call   80107d94 <loaduvm>
80100c67:	85 c0                	test   %eax,%eax
80100c69:	0f 88 6b 02 00 00    	js     80100eda <exec+0x3c6>
80100c6f:	eb 01                	jmp    80100c72 <exec+0x15e>
  sz = 0;
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
    if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
      goto bad;
    if(ph.type != ELF_PROG_LOAD)
      continue;
80100c71:	90                   	nop
  if((pgdir = setupkvm()) == 0)
    goto bad;

  // Load program into memory.
  sz = 0;
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100c72:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
80100c76:	8b 45 e8             	mov    -0x18(%ebp),%eax
80100c79:	83 c0 20             	add    $0x20,%eax
80100c7c:	89 45 e8             	mov    %eax,-0x18(%ebp)
80100c7f:	0f b7 85 38 ff ff ff 	movzwl -0xc8(%ebp),%eax
80100c86:	0f b7 c0             	movzwl %ax,%eax
80100c89:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80100c8c:	0f 8f 28 ff ff ff    	jg     80100bba <exec+0xa6>
    if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
      goto bad;
    if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
      goto bad;
  }
  iunlockput(ip);
80100c92:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100c95:	89 04 24             	mov    %eax,(%esp)
80100c98:	e8 5f 0e 00 00       	call   80101afc <iunlockput>
  ip = 0;
80100c9d:	c7 45 d8 00 00 00 00 	movl   $0x0,-0x28(%ebp)

  // Allocate two pages at the next page boundary.
  // Make the first inaccessible.  Use the second as the user stack.
  sz = PGROUNDUP(sz);
80100ca4:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100ca7:	05 ff 0f 00 00       	add    $0xfff,%eax
80100cac:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80100cb1:	89 45 e0             	mov    %eax,-0x20(%ebp)
  if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100cb4:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100cb7:	05 00 20 00 00       	add    $0x2000,%eax
80100cbc:	89 44 24 08          	mov    %eax,0x8(%esp)
80100cc0:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100cc3:	89 44 24 04          	mov    %eax,0x4(%esp)
80100cc7:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100cca:	89 04 24             	mov    %eax,(%esp)
80100ccd:	e8 b1 71 00 00       	call   80107e83 <allocuvm>
80100cd2:	89 45 e0             	mov    %eax,-0x20(%ebp)
80100cd5:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
80100cd9:	0f 84 fe 01 00 00    	je     80100edd <exec+0x3c9>
    goto bad;
  clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
80100cdf:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100ce2:	2d 00 20 00 00       	sub    $0x2000,%eax
80100ce7:	89 44 24 04          	mov    %eax,0x4(%esp)
80100ceb:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100cee:	89 04 24             	mov    %eax,(%esp)
80100cf1:	e8 d8 73 00 00       	call   801080ce <clearpteu>
  sp = sz;
80100cf6:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100cf9:	89 45 dc             	mov    %eax,-0x24(%ebp)

  // Push argument strings, prepare rest of stack in ustack.
  for(argc = 0; argv[argc]; argc++) {
80100cfc:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
80100d03:	e9 81 00 00 00       	jmp    80100d89 <exec+0x275>
    if(argc >= MAXARG)
80100d08:	83 7d e4 1f          	cmpl   $0x1f,-0x1c(%ebp)
80100d0c:	0f 87 ce 01 00 00    	ja     80100ee0 <exec+0x3cc>
      goto bad;
    sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100d12:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d15:	c1 e0 02             	shl    $0x2,%eax
80100d18:	03 45 0c             	add    0xc(%ebp),%eax
80100d1b:	8b 00                	mov    (%eax),%eax
80100d1d:	89 04 24             	mov    %eax,(%esp)
80100d20:	e8 f3 43 00 00       	call   80105118 <strlen>
80100d25:	f7 d0                	not    %eax
80100d27:	03 45 dc             	add    -0x24(%ebp),%eax
80100d2a:	83 e0 fc             	and    $0xfffffffc,%eax
80100d2d:	89 45 dc             	mov    %eax,-0x24(%ebp)
    if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100d30:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d33:	c1 e0 02             	shl    $0x2,%eax
80100d36:	03 45 0c             	add    0xc(%ebp),%eax
80100d39:	8b 00                	mov    (%eax),%eax
80100d3b:	89 04 24             	mov    %eax,(%esp)
80100d3e:	e8 d5 43 00 00       	call   80105118 <strlen>
80100d43:	83 c0 01             	add    $0x1,%eax
80100d46:	89 c2                	mov    %eax,%edx
80100d48:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d4b:	c1 e0 02             	shl    $0x2,%eax
80100d4e:	03 45 0c             	add    0xc(%ebp),%eax
80100d51:	8b 00                	mov    (%eax),%eax
80100d53:	89 54 24 0c          	mov    %edx,0xc(%esp)
80100d57:	89 44 24 08          	mov    %eax,0x8(%esp)
80100d5b:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100d5e:	89 44 24 04          	mov    %eax,0x4(%esp)
80100d62:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100d65:	89 04 24             	mov    %eax,(%esp)
80100d68:	e8 15 75 00 00       	call   80108282 <copyout>
80100d6d:	85 c0                	test   %eax,%eax
80100d6f:	0f 88 6e 01 00 00    	js     80100ee3 <exec+0x3cf>
      goto bad;
    ustack[3+argc] = sp;
80100d75:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d78:	8d 50 03             	lea    0x3(%eax),%edx
80100d7b:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100d7e:	89 84 95 40 ff ff ff 	mov    %eax,-0xc0(%ebp,%edx,4)
    goto bad;
  clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
  sp = sz;

  // Push argument strings, prepare rest of stack in ustack.
  for(argc = 0; argv[argc]; argc++) {
80100d85:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
80100d89:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d8c:	c1 e0 02             	shl    $0x2,%eax
80100d8f:	03 45 0c             	add    0xc(%ebp),%eax
80100d92:	8b 00                	mov    (%eax),%eax
80100d94:	85 c0                	test   %eax,%eax
80100d96:	0f 85 6c ff ff ff    	jne    80100d08 <exec+0x1f4>
    sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
    if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
      goto bad;
    ustack[3+argc] = sp;
  }
  ustack[3+argc] = 0;
80100d9c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d9f:	83 c0 03             	add    $0x3,%eax
80100da2:	c7 84 85 40 ff ff ff 	movl   $0x0,-0xc0(%ebp,%eax,4)
80100da9:	00 00 00 00 

  ustack[0] = 0xffffffff;  // fake return PC
80100dad:	c7 85 40 ff ff ff ff 	movl   $0xffffffff,-0xc0(%ebp)
80100db4:	ff ff ff 
  ustack[1] = argc;
80100db7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100dba:	89 85 44 ff ff ff    	mov    %eax,-0xbc(%ebp)
  ustack[2] = sp - (argc+1)*4;  // argv pointer
80100dc0:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100dc3:	83 c0 01             	add    $0x1,%eax
80100dc6:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80100dcd:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100dd0:	29 d0                	sub    %edx,%eax
80100dd2:	89 85 48 ff ff ff    	mov    %eax,-0xb8(%ebp)

  sp -= (3+argc+1) * 4;
80100dd8:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100ddb:	83 c0 04             	add    $0x4,%eax
80100dde:	c1 e0 02             	shl    $0x2,%eax
80100de1:	29 45 dc             	sub    %eax,-0x24(%ebp)
  if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100de4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100de7:	83 c0 04             	add    $0x4,%eax
80100dea:	c1 e0 02             	shl    $0x2,%eax
80100ded:	89 44 24 0c          	mov    %eax,0xc(%esp)
80100df1:	8d 85 40 ff ff ff    	lea    -0xc0(%ebp),%eax
80100df7:	89 44 24 08          	mov    %eax,0x8(%esp)
80100dfb:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100dfe:	89 44 24 04          	mov    %eax,0x4(%esp)
80100e02:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100e05:	89 04 24             	mov    %eax,(%esp)
80100e08:	e8 75 74 00 00       	call   80108282 <copyout>
80100e0d:	85 c0                	test   %eax,%eax
80100e0f:	0f 88 d1 00 00 00    	js     80100ee6 <exec+0x3d2>
    goto bad;

  // Save program name for debugging.
  for(last=s=path; *s; s++)
80100e15:	8b 45 08             	mov    0x8(%ebp),%eax
80100e18:	89 45 f4             	mov    %eax,-0xc(%ebp)
80100e1b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100e1e:	89 45 f0             	mov    %eax,-0x10(%ebp)
80100e21:	eb 17                	jmp    80100e3a <exec+0x326>
    if(*s == '/')
80100e23:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100e26:	0f b6 00             	movzbl (%eax),%eax
80100e29:	3c 2f                	cmp    $0x2f,%al
80100e2b:	75 09                	jne    80100e36 <exec+0x322>
      last = s+1;
80100e2d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100e30:	83 c0 01             	add    $0x1,%eax
80100e33:	89 45 f0             	mov    %eax,-0x10(%ebp)
  sp -= (3+argc+1) * 4;
  if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
    goto bad;

  // Save program name for debugging.
  for(last=s=path; *s; s++)
80100e36:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80100e3a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100e3d:	0f b6 00             	movzbl (%eax),%eax
80100e40:	84 c0                	test   %al,%al
80100e42:	75 df                	jne    80100e23 <exec+0x30f>
    if(*s == '/')
      last = s+1;
  safestrcpy(proc->name, last, sizeof(proc->name));
80100e44:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e4a:	8d 50 6c             	lea    0x6c(%eax),%edx
80100e4d:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
80100e54:	00 
80100e55:	8b 45 f0             	mov    -0x10(%ebp),%eax
80100e58:	89 44 24 04          	mov    %eax,0x4(%esp)
80100e5c:	89 14 24             	mov    %edx,(%esp)
80100e5f:	e8 66 42 00 00       	call   801050ca <safestrcpy>

  // Commit to the user image.
  oldpgdir = proc->pgdir;
80100e64:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e6a:	8b 40 04             	mov    0x4(%eax),%eax
80100e6d:	89 45 d0             	mov    %eax,-0x30(%ebp)
  proc->pgdir = pgdir;
80100e70:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e76:	8b 55 d4             	mov    -0x2c(%ebp),%edx
80100e79:	89 50 04             	mov    %edx,0x4(%eax)
  proc->sz = sz;
80100e7c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e82:	8b 55 e0             	mov    -0x20(%ebp),%edx
80100e85:	89 10                	mov    %edx,(%eax)
  proc->tf->eip = elf.entry;  // main
80100e87:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e8d:	8b 40 18             	mov    0x18(%eax),%eax
80100e90:	8b 95 24 ff ff ff    	mov    -0xdc(%ebp),%edx
80100e96:	89 50 38             	mov    %edx,0x38(%eax)
  proc->tf->esp = sp;
80100e99:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e9f:	8b 40 18             	mov    0x18(%eax),%eax
80100ea2:	8b 55 dc             	mov    -0x24(%ebp),%edx
80100ea5:	89 50 44             	mov    %edx,0x44(%eax)
  switchuvm(proc);
80100ea8:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100eae:	89 04 24             	mov    %eax,(%esp)
80100eb1:	e8 ec 6c 00 00       	call   80107ba2 <switchuvm>
  freevm(oldpgdir);
80100eb6:	8b 45 d0             	mov    -0x30(%ebp),%eax
80100eb9:	89 04 24             	mov    %eax,(%esp)
80100ebc:	e8 58 71 00 00       	call   80108019 <freevm>
  return 0;
80100ec1:	b8 00 00 00 00       	mov    $0x0,%eax
80100ec6:	eb 46                	jmp    80100f0e <exec+0x3fa>
  ilock(ip);
  pgdir = 0;

  // Check ELF header
  if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
    goto bad;
80100ec8:	90                   	nop
80100ec9:	eb 1c                	jmp    80100ee7 <exec+0x3d3>
  if(elf.magic != ELF_MAGIC)
    goto bad;
80100ecb:	90                   	nop
80100ecc:	eb 19                	jmp    80100ee7 <exec+0x3d3>

  if((pgdir = setupkvm()) == 0)
    goto bad;
80100ece:	90                   	nop
80100ecf:	eb 16                	jmp    80100ee7 <exec+0x3d3>

  // Load program into memory.
  sz = 0;
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
    if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
      goto bad;
80100ed1:	90                   	nop
80100ed2:	eb 13                	jmp    80100ee7 <exec+0x3d3>
    if(ph.type != ELF_PROG_LOAD)
      continue;
    if(ph.memsz < ph.filesz)
      goto bad;
80100ed4:	90                   	nop
80100ed5:	eb 10                	jmp    80100ee7 <exec+0x3d3>
    if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
      goto bad;
80100ed7:	90                   	nop
80100ed8:	eb 0d                	jmp    80100ee7 <exec+0x3d3>
    if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
      goto bad;
80100eda:	90                   	nop
80100edb:	eb 0a                	jmp    80100ee7 <exec+0x3d3>

  // Allocate two pages at the next page boundary.
  // Make the first inaccessible.  Use the second as the user stack.
  sz = PGROUNDUP(sz);
  if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
    goto bad;
80100edd:	90                   	nop
80100ede:	eb 07                	jmp    80100ee7 <exec+0x3d3>
  sp = sz;

  // Push argument strings, prepare rest of stack in ustack.
  for(argc = 0; argv[argc]; argc++) {
    if(argc >= MAXARG)
      goto bad;
80100ee0:	90                   	nop
80100ee1:	eb 04                	jmp    80100ee7 <exec+0x3d3>
    sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
    if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
      goto bad;
80100ee3:	90                   	nop
80100ee4:	eb 01                	jmp    80100ee7 <exec+0x3d3>
  ustack[1] = argc;
  ustack[2] = sp - (argc+1)*4;  // argv pointer

  sp -= (3+argc+1) * 4;
  if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
    goto bad;
80100ee6:	90                   	nop
  switchuvm(proc);
  freevm(oldpgdir);
  return 0;

 bad:
  if(pgdir)
80100ee7:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
80100eeb:	74 0b                	je     80100ef8 <exec+0x3e4>
    freevm(pgdir);
80100eed:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100ef0:	89 04 24             	mov    %eax,(%esp)
80100ef3:	e8 21 71 00 00       	call   80108019 <freevm>
  if(ip)
80100ef8:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
80100efc:	74 0b                	je     80100f09 <exec+0x3f5>
    iunlockput(ip);
80100efe:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100f01:	89 04 24             	mov    %eax,(%esp)
80100f04:	e8 f3 0b 00 00       	call   80101afc <iunlockput>
  return -1;
80100f09:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80100f0e:	c9                   	leave  
80100f0f:	c3                   	ret    

80100f10 <fileinit>:
  struct file file[NFILE];
} ftable;

void
fileinit(void)
{
80100f10:	55                   	push   %ebp
80100f11:	89 e5                	mov    %esp,%ebp
80100f13:	83 ec 18             	sub    $0x18,%esp
  initlock(&ftable.lock, "ftable");
80100f16:	c7 44 24 04 d5 88 10 	movl   $0x801088d5,0x4(%esp)
80100f1d:	80 
80100f1e:	c7 04 24 60 ee 10 80 	movl   $0x8010ee60,(%esp)
80100f25:	e8 00 3d 00 00       	call   80104c2a <initlock>
}
80100f2a:	c9                   	leave  
80100f2b:	c3                   	ret    

80100f2c <filealloc>:

// Allocate a file structure.
struct file*
filealloc(void)
{
80100f2c:	55                   	push   %ebp
80100f2d:	89 e5                	mov    %esp,%ebp
80100f2f:	83 ec 28             	sub    $0x28,%esp
  struct file *f;

  acquire(&ftable.lock);
80100f32:	c7 04 24 60 ee 10 80 	movl   $0x8010ee60,(%esp)
80100f39:	e8 0d 3d 00 00       	call   80104c4b <acquire>
  for(f = ftable.file; f < ftable.file + NFILE; f++){
80100f3e:	c7 45 f4 94 ee 10 80 	movl   $0x8010ee94,-0xc(%ebp)
80100f45:	eb 29                	jmp    80100f70 <filealloc+0x44>
    if(f->ref == 0){
80100f47:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100f4a:	8b 40 04             	mov    0x4(%eax),%eax
80100f4d:	85 c0                	test   %eax,%eax
80100f4f:	75 1b                	jne    80100f6c <filealloc+0x40>
      f->ref = 1;
80100f51:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100f54:	c7 40 04 01 00 00 00 	movl   $0x1,0x4(%eax)
      release(&ftable.lock);
80100f5b:	c7 04 24 60 ee 10 80 	movl   $0x8010ee60,(%esp)
80100f62:	e8 46 3d 00 00       	call   80104cad <release>
      return f;
80100f67:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100f6a:	eb 1e                	jmp    80100f8a <filealloc+0x5e>
filealloc(void)
{
  struct file *f;

  acquire(&ftable.lock);
  for(f = ftable.file; f < ftable.file + NFILE; f++){
80100f6c:	83 45 f4 18          	addl   $0x18,-0xc(%ebp)
80100f70:	81 7d f4 f4 f7 10 80 	cmpl   $0x8010f7f4,-0xc(%ebp)
80100f77:	72 ce                	jb     80100f47 <filealloc+0x1b>
      f->ref = 1;
      release(&ftable.lock);
      return f;
    }
  }
  release(&ftable.lock);
80100f79:	c7 04 24 60 ee 10 80 	movl   $0x8010ee60,(%esp)
80100f80:	e8 28 3d 00 00       	call   80104cad <release>
  return 0;
80100f85:	b8 00 00 00 00       	mov    $0x0,%eax
}
80100f8a:	c9                   	leave  
80100f8b:	c3                   	ret    

80100f8c <filedup>:

// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
80100f8c:	55                   	push   %ebp
80100f8d:	89 e5                	mov    %esp,%ebp
80100f8f:	83 ec 18             	sub    $0x18,%esp
  acquire(&ftable.lock);
80100f92:	c7 04 24 60 ee 10 80 	movl   $0x8010ee60,(%esp)
80100f99:	e8 ad 3c 00 00       	call   80104c4b <acquire>
  if(f->ref < 1)
80100f9e:	8b 45 08             	mov    0x8(%ebp),%eax
80100fa1:	8b 40 04             	mov    0x4(%eax),%eax
80100fa4:	85 c0                	test   %eax,%eax
80100fa6:	7f 0c                	jg     80100fb4 <filedup+0x28>
    panic("filedup");
80100fa8:	c7 04 24 dc 88 10 80 	movl   $0x801088dc,(%esp)
80100faf:	e8 a1 f5 ff ff       	call   80100555 <panic>
  f->ref++;
80100fb4:	8b 45 08             	mov    0x8(%ebp),%eax
80100fb7:	8b 40 04             	mov    0x4(%eax),%eax
80100fba:	8d 50 01             	lea    0x1(%eax),%edx
80100fbd:	8b 45 08             	mov    0x8(%ebp),%eax
80100fc0:	89 50 04             	mov    %edx,0x4(%eax)
  release(&ftable.lock);
80100fc3:	c7 04 24 60 ee 10 80 	movl   $0x8010ee60,(%esp)
80100fca:	e8 de 3c 00 00       	call   80104cad <release>
  return f;
80100fcf:	8b 45 08             	mov    0x8(%ebp),%eax
}
80100fd2:	c9                   	leave  
80100fd3:	c3                   	ret    

80100fd4 <fileclose>:

// Close file f.  (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
80100fd4:	55                   	push   %ebp
80100fd5:	89 e5                	mov    %esp,%ebp
80100fd7:	83 ec 38             	sub    $0x38,%esp
  struct file ff;

  acquire(&ftable.lock);
80100fda:	c7 04 24 60 ee 10 80 	movl   $0x8010ee60,(%esp)
80100fe1:	e8 65 3c 00 00       	call   80104c4b <acquire>
  if(f->ref < 1)
80100fe6:	8b 45 08             	mov    0x8(%ebp),%eax
80100fe9:	8b 40 04             	mov    0x4(%eax),%eax
80100fec:	85 c0                	test   %eax,%eax
80100fee:	7f 0c                	jg     80100ffc <fileclose+0x28>
    panic("fileclose");
80100ff0:	c7 04 24 e4 88 10 80 	movl   $0x801088e4,(%esp)
80100ff7:	e8 59 f5 ff ff       	call   80100555 <panic>
  if(--f->ref > 0){
80100ffc:	8b 45 08             	mov    0x8(%ebp),%eax
80100fff:	8b 40 04             	mov    0x4(%eax),%eax
80101002:	8d 50 ff             	lea    -0x1(%eax),%edx
80101005:	8b 45 08             	mov    0x8(%ebp),%eax
80101008:	89 50 04             	mov    %edx,0x4(%eax)
8010100b:	8b 45 08             	mov    0x8(%ebp),%eax
8010100e:	8b 40 04             	mov    0x4(%eax),%eax
80101011:	85 c0                	test   %eax,%eax
80101013:	7e 11                	jle    80101026 <fileclose+0x52>
    release(&ftable.lock);
80101015:	c7 04 24 60 ee 10 80 	movl   $0x8010ee60,(%esp)
8010101c:	e8 8c 3c 00 00       	call   80104cad <release>
    return;
80101021:	e9 82 00 00 00       	jmp    801010a8 <fileclose+0xd4>
  }
  ff = *f;
80101026:	8b 45 08             	mov    0x8(%ebp),%eax
80101029:	8b 10                	mov    (%eax),%edx
8010102b:	89 55 e0             	mov    %edx,-0x20(%ebp)
8010102e:	8b 50 04             	mov    0x4(%eax),%edx
80101031:	89 55 e4             	mov    %edx,-0x1c(%ebp)
80101034:	8b 50 08             	mov    0x8(%eax),%edx
80101037:	89 55 e8             	mov    %edx,-0x18(%ebp)
8010103a:	8b 50 0c             	mov    0xc(%eax),%edx
8010103d:	89 55 ec             	mov    %edx,-0x14(%ebp)
80101040:	8b 50 10             	mov    0x10(%eax),%edx
80101043:	89 55 f0             	mov    %edx,-0x10(%ebp)
80101046:	8b 40 14             	mov    0x14(%eax),%eax
80101049:	89 45 f4             	mov    %eax,-0xc(%ebp)
  f->ref = 0;
8010104c:	8b 45 08             	mov    0x8(%ebp),%eax
8010104f:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
  f->type = FD_NONE;
80101056:	8b 45 08             	mov    0x8(%ebp),%eax
80101059:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
  release(&ftable.lock);
8010105f:	c7 04 24 60 ee 10 80 	movl   $0x8010ee60,(%esp)
80101066:	e8 42 3c 00 00       	call   80104cad <release>
  
  if(ff.type == FD_PIPE)
8010106b:	8b 45 e0             	mov    -0x20(%ebp),%eax
8010106e:	83 f8 01             	cmp    $0x1,%eax
80101071:	75 18                	jne    8010108b <fileclose+0xb7>
    pipeclose(ff.pipe, ff.writable);
80101073:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
80101077:	0f be d0             	movsbl %al,%edx
8010107a:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010107d:	89 54 24 04          	mov    %edx,0x4(%esp)
80101081:	89 04 24             	mov    %eax,(%esp)
80101084:	e8 32 2e 00 00       	call   80103ebb <pipeclose>
80101089:	eb 1d                	jmp    801010a8 <fileclose+0xd4>
  else if(ff.type == FD_INODE){
8010108b:	8b 45 e0             	mov    -0x20(%ebp),%eax
8010108e:	83 f8 02             	cmp    $0x2,%eax
80101091:	75 15                	jne    801010a8 <fileclose+0xd4>
    begin_trans();
80101093:	e8 99 22 00 00       	call   80103331 <begin_trans>
    iput(ff.ip);
80101098:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010109b:	89 04 24             	mov    %eax,(%esp)
8010109e:	e8 88 09 00 00       	call   80101a2b <iput>
    commit_trans();
801010a3:	e8 d2 22 00 00       	call   8010337a <commit_trans>
  }
}
801010a8:	c9                   	leave  
801010a9:	c3                   	ret    

801010aa <filestat>:

// Get metadata about file f.
int
filestat(struct file *f, struct stat *st)
{
801010aa:	55                   	push   %ebp
801010ab:	89 e5                	mov    %esp,%ebp
801010ad:	83 ec 18             	sub    $0x18,%esp
  if(f->type == FD_INODE){
801010b0:	8b 45 08             	mov    0x8(%ebp),%eax
801010b3:	8b 00                	mov    (%eax),%eax
801010b5:	83 f8 02             	cmp    $0x2,%eax
801010b8:	75 38                	jne    801010f2 <filestat+0x48>
    ilock(f->ip);
801010ba:	8b 45 08             	mov    0x8(%ebp),%eax
801010bd:	8b 40 10             	mov    0x10(%eax),%eax
801010c0:	89 04 24             	mov    %eax,(%esp)
801010c3:	e8 b0 07 00 00       	call   80101878 <ilock>
    stati(f->ip, st);
801010c8:	8b 45 08             	mov    0x8(%ebp),%eax
801010cb:	8b 40 10             	mov    0x10(%eax),%eax
801010ce:	8b 55 0c             	mov    0xc(%ebp),%edx
801010d1:	89 54 24 04          	mov    %edx,0x4(%esp)
801010d5:	89 04 24             	mov    %eax,(%esp)
801010d8:	e8 4c 0c 00 00       	call   80101d29 <stati>
    iunlock(f->ip);
801010dd:	8b 45 08             	mov    0x8(%ebp),%eax
801010e0:	8b 40 10             	mov    0x10(%eax),%eax
801010e3:	89 04 24             	mov    %eax,(%esp)
801010e6:	e8 db 08 00 00       	call   801019c6 <iunlock>
    return 0;
801010eb:	b8 00 00 00 00       	mov    $0x0,%eax
801010f0:	eb 05                	jmp    801010f7 <filestat+0x4d>
  }
  return -1;
801010f2:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
801010f7:	c9                   	leave  
801010f8:	c3                   	ret    

801010f9 <fileread>:

// Read from file f.
int
fileread(struct file *f, char *addr, int n)
{
801010f9:	55                   	push   %ebp
801010fa:	89 e5                	mov    %esp,%ebp
801010fc:	83 ec 28             	sub    $0x28,%esp
  int r;

  if(f->readable == 0)
801010ff:	8b 45 08             	mov    0x8(%ebp),%eax
80101102:	0f b6 40 08          	movzbl 0x8(%eax),%eax
80101106:	84 c0                	test   %al,%al
80101108:	75 0a                	jne    80101114 <fileread+0x1b>
    return -1;
8010110a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010110f:	e9 9f 00 00 00       	jmp    801011b3 <fileread+0xba>
  if(f->type == FD_PIPE)
80101114:	8b 45 08             	mov    0x8(%ebp),%eax
80101117:	8b 00                	mov    (%eax),%eax
80101119:	83 f8 01             	cmp    $0x1,%eax
8010111c:	75 1e                	jne    8010113c <fileread+0x43>
    return piperead(f->pipe, addr, n);
8010111e:	8b 45 08             	mov    0x8(%ebp),%eax
80101121:	8b 40 0c             	mov    0xc(%eax),%eax
80101124:	8b 55 10             	mov    0x10(%ebp),%edx
80101127:	89 54 24 08          	mov    %edx,0x8(%esp)
8010112b:	8b 55 0c             	mov    0xc(%ebp),%edx
8010112e:	89 54 24 04          	mov    %edx,0x4(%esp)
80101132:	89 04 24             	mov    %eax,(%esp)
80101135:	e8 03 2f 00 00       	call   8010403d <piperead>
8010113a:	eb 77                	jmp    801011b3 <fileread+0xba>
  if(f->type == FD_INODE){
8010113c:	8b 45 08             	mov    0x8(%ebp),%eax
8010113f:	8b 00                	mov    (%eax),%eax
80101141:	83 f8 02             	cmp    $0x2,%eax
80101144:	75 61                	jne    801011a7 <fileread+0xae>
    ilock(f->ip);
80101146:	8b 45 08             	mov    0x8(%ebp),%eax
80101149:	8b 40 10             	mov    0x10(%eax),%eax
8010114c:	89 04 24             	mov    %eax,(%esp)
8010114f:	e8 24 07 00 00       	call   80101878 <ilock>
    if((r = readi(f->ip, addr, f->off, n)) > 0)
80101154:	8b 4d 10             	mov    0x10(%ebp),%ecx
80101157:	8b 45 08             	mov    0x8(%ebp),%eax
8010115a:	8b 50 14             	mov    0x14(%eax),%edx
8010115d:	8b 45 08             	mov    0x8(%ebp),%eax
80101160:	8b 40 10             	mov    0x10(%eax),%eax
80101163:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
80101167:	89 54 24 08          	mov    %edx,0x8(%esp)
8010116b:	8b 55 0c             	mov    0xc(%ebp),%edx
8010116e:	89 54 24 04          	mov    %edx,0x4(%esp)
80101172:	89 04 24             	mov    %eax,(%esp)
80101175:	e8 f4 0b 00 00       	call   80101d6e <readi>
8010117a:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010117d:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101181:	7e 11                	jle    80101194 <fileread+0x9b>
      f->off += r;
80101183:	8b 45 08             	mov    0x8(%ebp),%eax
80101186:	8b 50 14             	mov    0x14(%eax),%edx
80101189:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010118c:	01 c2                	add    %eax,%edx
8010118e:	8b 45 08             	mov    0x8(%ebp),%eax
80101191:	89 50 14             	mov    %edx,0x14(%eax)
    iunlock(f->ip);
80101194:	8b 45 08             	mov    0x8(%ebp),%eax
80101197:	8b 40 10             	mov    0x10(%eax),%eax
8010119a:	89 04 24             	mov    %eax,(%esp)
8010119d:	e8 24 08 00 00       	call   801019c6 <iunlock>
    return r;
801011a2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801011a5:	eb 0c                	jmp    801011b3 <fileread+0xba>
  }
  panic("fileread");
801011a7:	c7 04 24 ee 88 10 80 	movl   $0x801088ee,(%esp)
801011ae:	e8 a2 f3 ff ff       	call   80100555 <panic>
}
801011b3:	c9                   	leave  
801011b4:	c3                   	ret    

801011b5 <filewrite>:

//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
801011b5:	55                   	push   %ebp
801011b6:	89 e5                	mov    %esp,%ebp
801011b8:	53                   	push   %ebx
801011b9:	83 ec 24             	sub    $0x24,%esp
  int r;

  if(f->writable == 0)
801011bc:	8b 45 08             	mov    0x8(%ebp),%eax
801011bf:	0f b6 40 09          	movzbl 0x9(%eax),%eax
801011c3:	84 c0                	test   %al,%al
801011c5:	75 0a                	jne    801011d1 <filewrite+0x1c>
    return -1;
801011c7:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801011cc:	e9 23 01 00 00       	jmp    801012f4 <filewrite+0x13f>
  if(f->type == FD_PIPE)
801011d1:	8b 45 08             	mov    0x8(%ebp),%eax
801011d4:	8b 00                	mov    (%eax),%eax
801011d6:	83 f8 01             	cmp    $0x1,%eax
801011d9:	75 21                	jne    801011fc <filewrite+0x47>
    return pipewrite(f->pipe, addr, n);
801011db:	8b 45 08             	mov    0x8(%ebp),%eax
801011de:	8b 40 0c             	mov    0xc(%eax),%eax
801011e1:	8b 55 10             	mov    0x10(%ebp),%edx
801011e4:	89 54 24 08          	mov    %edx,0x8(%esp)
801011e8:	8b 55 0c             	mov    0xc(%ebp),%edx
801011eb:	89 54 24 04          	mov    %edx,0x4(%esp)
801011ef:	89 04 24             	mov    %eax,(%esp)
801011f2:	e8 56 2d 00 00       	call   80103f4d <pipewrite>
801011f7:	e9 f8 00 00 00       	jmp    801012f4 <filewrite+0x13f>
  if(f->type == FD_INODE){
801011fc:	8b 45 08             	mov    0x8(%ebp),%eax
801011ff:	8b 00                	mov    (%eax),%eax
80101201:	83 f8 02             	cmp    $0x2,%eax
80101204:	0f 85 de 00 00 00    	jne    801012e8 <filewrite+0x133>
    // the maximum log transaction size, including
    // i-node, indirect block, allocation blocks,
    // and 2 blocks of slop for non-aligned writes.
    // this really belongs lower down, since writei()
    // might be writing a device like the console.
    int max = ((LOGSIZE-1-1-2) / 2) * 512;
8010120a:	c7 45 ec 00 06 00 00 	movl   $0x600,-0x14(%ebp)
    int i = 0;
80101211:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while(i < n){
80101218:	e9 a8 00 00 00       	jmp    801012c5 <filewrite+0x110>
      int n1 = n - i;
8010121d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101220:	8b 55 10             	mov    0x10(%ebp),%edx
80101223:	89 d1                	mov    %edx,%ecx
80101225:	29 c1                	sub    %eax,%ecx
80101227:	89 c8                	mov    %ecx,%eax
80101229:	89 45 f0             	mov    %eax,-0x10(%ebp)
      if(n1 > max)
8010122c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010122f:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80101232:	7e 06                	jle    8010123a <filewrite+0x85>
        n1 = max;
80101234:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101237:	89 45 f0             	mov    %eax,-0x10(%ebp)

      begin_trans();
8010123a:	e8 f2 20 00 00       	call   80103331 <begin_trans>
      ilock(f->ip);
8010123f:	8b 45 08             	mov    0x8(%ebp),%eax
80101242:	8b 40 10             	mov    0x10(%eax),%eax
80101245:	89 04 24             	mov    %eax,(%esp)
80101248:	e8 2b 06 00 00       	call   80101878 <ilock>
      if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
8010124d:	8b 5d f0             	mov    -0x10(%ebp),%ebx
80101250:	8b 45 08             	mov    0x8(%ebp),%eax
80101253:	8b 48 14             	mov    0x14(%eax),%ecx
80101256:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101259:	89 c2                	mov    %eax,%edx
8010125b:	03 55 0c             	add    0xc(%ebp),%edx
8010125e:	8b 45 08             	mov    0x8(%ebp),%eax
80101261:	8b 40 10             	mov    0x10(%eax),%eax
80101264:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
80101268:	89 4c 24 08          	mov    %ecx,0x8(%esp)
8010126c:	89 54 24 04          	mov    %edx,0x4(%esp)
80101270:	89 04 24             	mov    %eax,(%esp)
80101273:	e8 61 0c 00 00       	call   80101ed9 <writei>
80101278:	89 45 e8             	mov    %eax,-0x18(%ebp)
8010127b:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
8010127f:	7e 11                	jle    80101292 <filewrite+0xdd>
        f->off += r;
80101281:	8b 45 08             	mov    0x8(%ebp),%eax
80101284:	8b 50 14             	mov    0x14(%eax),%edx
80101287:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010128a:	01 c2                	add    %eax,%edx
8010128c:	8b 45 08             	mov    0x8(%ebp),%eax
8010128f:	89 50 14             	mov    %edx,0x14(%eax)
      iunlock(f->ip);
80101292:	8b 45 08             	mov    0x8(%ebp),%eax
80101295:	8b 40 10             	mov    0x10(%eax),%eax
80101298:	89 04 24             	mov    %eax,(%esp)
8010129b:	e8 26 07 00 00       	call   801019c6 <iunlock>
      commit_trans();
801012a0:	e8 d5 20 00 00       	call   8010337a <commit_trans>

      if(r < 0)
801012a5:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
801012a9:	78 28                	js     801012d3 <filewrite+0x11e>
        break;
      if(r != n1)
801012ab:	8b 45 e8             	mov    -0x18(%ebp),%eax
801012ae:	3b 45 f0             	cmp    -0x10(%ebp),%eax
801012b1:	74 0c                	je     801012bf <filewrite+0x10a>
        panic("short filewrite");
801012b3:	c7 04 24 f7 88 10 80 	movl   $0x801088f7,(%esp)
801012ba:	e8 96 f2 ff ff       	call   80100555 <panic>
      i += r;
801012bf:	8b 45 e8             	mov    -0x18(%ebp),%eax
801012c2:	01 45 f4             	add    %eax,-0xc(%ebp)
    // and 2 blocks of slop for non-aligned writes.
    // this really belongs lower down, since writei()
    // might be writing a device like the console.
    int max = ((LOGSIZE-1-1-2) / 2) * 512;
    int i = 0;
    while(i < n){
801012c5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801012c8:	3b 45 10             	cmp    0x10(%ebp),%eax
801012cb:	0f 8c 4c ff ff ff    	jl     8010121d <filewrite+0x68>
801012d1:	eb 01                	jmp    801012d4 <filewrite+0x11f>
        f->off += r;
      iunlock(f->ip);
      commit_trans();

      if(r < 0)
        break;
801012d3:	90                   	nop
      if(r != n1)
        panic("short filewrite");
      i += r;
    }
    return i == n ? n : -1;
801012d4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801012d7:	3b 45 10             	cmp    0x10(%ebp),%eax
801012da:	75 05                	jne    801012e1 <filewrite+0x12c>
801012dc:	8b 45 10             	mov    0x10(%ebp),%eax
801012df:	eb 05                	jmp    801012e6 <filewrite+0x131>
801012e1:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801012e6:	eb 0c                	jmp    801012f4 <filewrite+0x13f>
  }
  panic("filewrite");
801012e8:	c7 04 24 07 89 10 80 	movl   $0x80108907,(%esp)
801012ef:	e8 61 f2 ff ff       	call   80100555 <panic>
}
801012f4:	83 c4 24             	add    $0x24,%esp
801012f7:	5b                   	pop    %ebx
801012f8:	5d                   	pop    %ebp
801012f9:	c3                   	ret    
	...

801012fc <readsb>:
static void itrunc(struct inode*);

// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
801012fc:	55                   	push   %ebp
801012fd:	89 e5                	mov    %esp,%ebp
801012ff:	83 ec 28             	sub    $0x28,%esp
  struct buf *bp;
  
  bp = bread(dev, 1);
80101302:	8b 45 08             	mov    0x8(%ebp),%eax
80101305:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
8010130c:	00 
8010130d:	89 04 24             	mov    %eax,(%esp)
80101310:	e8 91 ee ff ff       	call   801001a6 <bread>
80101315:	89 45 f4             	mov    %eax,-0xc(%ebp)
  memmove(sb, bp->data, sizeof(*sb));
80101318:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010131b:	83 c0 18             	add    $0x18,%eax
8010131e:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
80101325:	00 
80101326:	89 44 24 04          	mov    %eax,0x4(%esp)
8010132a:	8b 45 0c             	mov    0xc(%ebp),%eax
8010132d:	89 04 24             	mov    %eax,(%esp)
80101330:	e8 38 3c 00 00       	call   80104f6d <memmove>
  brelse(bp);
80101335:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101338:	89 04 24             	mov    %eax,(%esp)
8010133b:	e8 d7 ee ff ff       	call   80100217 <brelse>
}
80101340:	c9                   	leave  
80101341:	c3                   	ret    

80101342 <bzero>:

// Zero a block.
static void
bzero(int dev, int bno)
{
80101342:	55                   	push   %ebp
80101343:	89 e5                	mov    %esp,%ebp
80101345:	83 ec 28             	sub    $0x28,%esp
  struct buf *bp;
  
  bp = bread(dev, bno);
80101348:	8b 55 0c             	mov    0xc(%ebp),%edx
8010134b:	8b 45 08             	mov    0x8(%ebp),%eax
8010134e:	89 54 24 04          	mov    %edx,0x4(%esp)
80101352:	89 04 24             	mov    %eax,(%esp)
80101355:	e8 4c ee ff ff       	call   801001a6 <bread>
8010135a:	89 45 f4             	mov    %eax,-0xc(%ebp)
  memset(bp->data, 0, BSIZE);
8010135d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101360:	83 c0 18             	add    $0x18,%eax
80101363:	c7 44 24 08 00 02 00 	movl   $0x200,0x8(%esp)
8010136a:	00 
8010136b:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80101372:	00 
80101373:	89 04 24             	mov    %eax,(%esp)
80101376:	e8 1f 3b 00 00       	call   80104e9a <memset>
  log_write(bp);
8010137b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010137e:	89 04 24             	mov    %eax,(%esp)
80101381:	e8 4c 20 00 00       	call   801033d2 <log_write>
  brelse(bp);
80101386:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101389:	89 04 24             	mov    %eax,(%esp)
8010138c:	e8 86 ee ff ff       	call   80100217 <brelse>
}
80101391:	c9                   	leave  
80101392:	c3                   	ret    

80101393 <balloc>:
// Blocks. 

// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
80101393:	55                   	push   %ebp
80101394:	89 e5                	mov    %esp,%ebp
80101396:	53                   	push   %ebx
80101397:	83 ec 34             	sub    $0x34,%esp
  int b, bi, m;
  struct buf *bp;
  struct superblock sb;

  bp = 0;
8010139a:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
  readsb(dev, &sb);
801013a1:	8b 45 08             	mov    0x8(%ebp),%eax
801013a4:	8d 55 d8             	lea    -0x28(%ebp),%edx
801013a7:	89 54 24 04          	mov    %edx,0x4(%esp)
801013ab:	89 04 24             	mov    %eax,(%esp)
801013ae:	e8 49 ff ff ff       	call   801012fc <readsb>
  for(b = 0; b < sb.size; b += BPB){
801013b3:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801013ba:	e9 11 01 00 00       	jmp    801014d0 <balloc+0x13d>
    bp = bread(dev, BBLOCK(b, sb.ninodes));
801013bf:	8b 45 f4             	mov    -0xc(%ebp),%eax
801013c2:	8d 90 ff 0f 00 00    	lea    0xfff(%eax),%edx
801013c8:	85 c0                	test   %eax,%eax
801013ca:	0f 48 c2             	cmovs  %edx,%eax
801013cd:	c1 f8 0c             	sar    $0xc,%eax
801013d0:	8b 55 e0             	mov    -0x20(%ebp),%edx
801013d3:	c1 ea 03             	shr    $0x3,%edx
801013d6:	01 d0                	add    %edx,%eax
801013d8:	83 c0 03             	add    $0x3,%eax
801013db:	89 44 24 04          	mov    %eax,0x4(%esp)
801013df:	8b 45 08             	mov    0x8(%ebp),%eax
801013e2:	89 04 24             	mov    %eax,(%esp)
801013e5:	e8 bc ed ff ff       	call   801001a6 <bread>
801013ea:	89 45 ec             	mov    %eax,-0x14(%ebp)
    for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
801013ed:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
801013f4:	e9 a7 00 00 00       	jmp    801014a0 <balloc+0x10d>
      m = 1 << (bi % 8);
801013f9:	8b 45 f0             	mov    -0x10(%ebp),%eax
801013fc:	89 c2                	mov    %eax,%edx
801013fe:	c1 fa 1f             	sar    $0x1f,%edx
80101401:	c1 ea 1d             	shr    $0x1d,%edx
80101404:	01 d0                	add    %edx,%eax
80101406:	83 e0 07             	and    $0x7,%eax
80101409:	29 d0                	sub    %edx,%eax
8010140b:	ba 01 00 00 00       	mov    $0x1,%edx
80101410:	89 d3                	mov    %edx,%ebx
80101412:	89 c1                	mov    %eax,%ecx
80101414:	d3 e3                	shl    %cl,%ebx
80101416:	89 d8                	mov    %ebx,%eax
80101418:	89 45 e8             	mov    %eax,-0x18(%ebp)
      if((bp->data[bi/8] & m) == 0){  // Is block free?
8010141b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010141e:	8d 50 07             	lea    0x7(%eax),%edx
80101421:	85 c0                	test   %eax,%eax
80101423:	0f 48 c2             	cmovs  %edx,%eax
80101426:	c1 f8 03             	sar    $0x3,%eax
80101429:	8b 55 ec             	mov    -0x14(%ebp),%edx
8010142c:	0f b6 44 02 18       	movzbl 0x18(%edx,%eax,1),%eax
80101431:	0f b6 c0             	movzbl %al,%eax
80101434:	23 45 e8             	and    -0x18(%ebp),%eax
80101437:	85 c0                	test   %eax,%eax
80101439:	75 61                	jne    8010149c <balloc+0x109>
        bp->data[bi/8] |= m;  // Mark block in use.
8010143b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010143e:	8d 50 07             	lea    0x7(%eax),%edx
80101441:	85 c0                	test   %eax,%eax
80101443:	0f 48 c2             	cmovs  %edx,%eax
80101446:	c1 f8 03             	sar    $0x3,%eax
80101449:	8b 55 ec             	mov    -0x14(%ebp),%edx
8010144c:	0f b6 54 02 18       	movzbl 0x18(%edx,%eax,1),%edx
80101451:	89 d1                	mov    %edx,%ecx
80101453:	8b 55 e8             	mov    -0x18(%ebp),%edx
80101456:	09 ca                	or     %ecx,%edx
80101458:	89 d1                	mov    %edx,%ecx
8010145a:	8b 55 ec             	mov    -0x14(%ebp),%edx
8010145d:	88 4c 02 18          	mov    %cl,0x18(%edx,%eax,1)
        log_write(bp);
80101461:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101464:	89 04 24             	mov    %eax,(%esp)
80101467:	e8 66 1f 00 00       	call   801033d2 <log_write>
        brelse(bp);
8010146c:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010146f:	89 04 24             	mov    %eax,(%esp)
80101472:	e8 a0 ed ff ff       	call   80100217 <brelse>
        bzero(dev, b + bi);
80101477:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010147a:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010147d:	01 c2                	add    %eax,%edx
8010147f:	8b 45 08             	mov    0x8(%ebp),%eax
80101482:	89 54 24 04          	mov    %edx,0x4(%esp)
80101486:	89 04 24             	mov    %eax,(%esp)
80101489:	e8 b4 fe ff ff       	call   80101342 <bzero>
        return b + bi;
8010148e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101491:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101494:	01 d0                	add    %edx,%eax
      }
    }
    brelse(bp);
  }
  panic("balloc: out of blocks");
}
80101496:	83 c4 34             	add    $0x34,%esp
80101499:	5b                   	pop    %ebx
8010149a:	5d                   	pop    %ebp
8010149b:	c3                   	ret    

  bp = 0;
  readsb(dev, &sb);
  for(b = 0; b < sb.size; b += BPB){
    bp = bread(dev, BBLOCK(b, sb.ninodes));
    for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
8010149c:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
801014a0:	81 7d f0 ff 0f 00 00 	cmpl   $0xfff,-0x10(%ebp)
801014a7:	7f 15                	jg     801014be <balloc+0x12b>
801014a9:	8b 45 f0             	mov    -0x10(%ebp),%eax
801014ac:	8b 55 f4             	mov    -0xc(%ebp),%edx
801014af:	01 d0                	add    %edx,%eax
801014b1:	89 c2                	mov    %eax,%edx
801014b3:	8b 45 d8             	mov    -0x28(%ebp),%eax
801014b6:	39 c2                	cmp    %eax,%edx
801014b8:	0f 82 3b ff ff ff    	jb     801013f9 <balloc+0x66>
        brelse(bp);
        bzero(dev, b + bi);
        return b + bi;
      }
    }
    brelse(bp);
801014be:	8b 45 ec             	mov    -0x14(%ebp),%eax
801014c1:	89 04 24             	mov    %eax,(%esp)
801014c4:	e8 4e ed ff ff       	call   80100217 <brelse>
  struct buf *bp;
  struct superblock sb;

  bp = 0;
  readsb(dev, &sb);
  for(b = 0; b < sb.size; b += BPB){
801014c9:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
801014d0:	8b 55 f4             	mov    -0xc(%ebp),%edx
801014d3:	8b 45 d8             	mov    -0x28(%ebp),%eax
801014d6:	39 c2                	cmp    %eax,%edx
801014d8:	0f 82 e1 fe ff ff    	jb     801013bf <balloc+0x2c>
        return b + bi;
      }
    }
    brelse(bp);
  }
  panic("balloc: out of blocks");
801014de:	c7 04 24 11 89 10 80 	movl   $0x80108911,(%esp)
801014e5:	e8 6b f0 ff ff       	call   80100555 <panic>

801014ea <bfree>:
}

// Free a disk block.
static void
bfree(int dev, uint b)
{
801014ea:	55                   	push   %ebp
801014eb:	89 e5                	mov    %esp,%ebp
801014ed:	53                   	push   %ebx
801014ee:	83 ec 34             	sub    $0x34,%esp
  struct buf *bp;
  struct superblock sb;
  int bi, m;

  readsb(dev, &sb);
801014f1:	8d 45 dc             	lea    -0x24(%ebp),%eax
801014f4:	89 44 24 04          	mov    %eax,0x4(%esp)
801014f8:	8b 45 08             	mov    0x8(%ebp),%eax
801014fb:	89 04 24             	mov    %eax,(%esp)
801014fe:	e8 f9 fd ff ff       	call   801012fc <readsb>
  bp = bread(dev, BBLOCK(b, sb.ninodes));
80101503:	8b 45 0c             	mov    0xc(%ebp),%eax
80101506:	89 c2                	mov    %eax,%edx
80101508:	c1 ea 0c             	shr    $0xc,%edx
8010150b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
8010150e:	c1 e8 03             	shr    $0x3,%eax
80101511:	01 d0                	add    %edx,%eax
80101513:	8d 50 03             	lea    0x3(%eax),%edx
80101516:	8b 45 08             	mov    0x8(%ebp),%eax
80101519:	89 54 24 04          	mov    %edx,0x4(%esp)
8010151d:	89 04 24             	mov    %eax,(%esp)
80101520:	e8 81 ec ff ff       	call   801001a6 <bread>
80101525:	89 45 f4             	mov    %eax,-0xc(%ebp)
  bi = b % BPB;
80101528:	8b 45 0c             	mov    0xc(%ebp),%eax
8010152b:	25 ff 0f 00 00       	and    $0xfff,%eax
80101530:	89 45 f0             	mov    %eax,-0x10(%ebp)
  m = 1 << (bi % 8);
80101533:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101536:	89 c2                	mov    %eax,%edx
80101538:	c1 fa 1f             	sar    $0x1f,%edx
8010153b:	c1 ea 1d             	shr    $0x1d,%edx
8010153e:	01 d0                	add    %edx,%eax
80101540:	83 e0 07             	and    $0x7,%eax
80101543:	29 d0                	sub    %edx,%eax
80101545:	ba 01 00 00 00       	mov    $0x1,%edx
8010154a:	89 d3                	mov    %edx,%ebx
8010154c:	89 c1                	mov    %eax,%ecx
8010154e:	d3 e3                	shl    %cl,%ebx
80101550:	89 d8                	mov    %ebx,%eax
80101552:	89 45 ec             	mov    %eax,-0x14(%ebp)
  if((bp->data[bi/8] & m) == 0)
80101555:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101558:	8d 50 07             	lea    0x7(%eax),%edx
8010155b:	85 c0                	test   %eax,%eax
8010155d:	0f 48 c2             	cmovs  %edx,%eax
80101560:	c1 f8 03             	sar    $0x3,%eax
80101563:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101566:	0f b6 44 02 18       	movzbl 0x18(%edx,%eax,1),%eax
8010156b:	0f b6 c0             	movzbl %al,%eax
8010156e:	23 45 ec             	and    -0x14(%ebp),%eax
80101571:	85 c0                	test   %eax,%eax
80101573:	75 0c                	jne    80101581 <bfree+0x97>
    panic("freeing free block");
80101575:	c7 04 24 27 89 10 80 	movl   $0x80108927,(%esp)
8010157c:	e8 d4 ef ff ff       	call   80100555 <panic>
  bp->data[bi/8] &= ~m;
80101581:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101584:	8d 50 07             	lea    0x7(%eax),%edx
80101587:	85 c0                	test   %eax,%eax
80101589:	0f 48 c2             	cmovs  %edx,%eax
8010158c:	c1 f8 03             	sar    $0x3,%eax
8010158f:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101592:	0f b6 54 02 18       	movzbl 0x18(%edx,%eax,1),%edx
80101597:	8b 4d ec             	mov    -0x14(%ebp),%ecx
8010159a:	f7 d1                	not    %ecx
8010159c:	21 ca                	and    %ecx,%edx
8010159e:	89 d1                	mov    %edx,%ecx
801015a0:	8b 55 f4             	mov    -0xc(%ebp),%edx
801015a3:	88 4c 02 18          	mov    %cl,0x18(%edx,%eax,1)
  log_write(bp);
801015a7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801015aa:	89 04 24             	mov    %eax,(%esp)
801015ad:	e8 20 1e 00 00       	call   801033d2 <log_write>
  brelse(bp);
801015b2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801015b5:	89 04 24             	mov    %eax,(%esp)
801015b8:	e8 5a ec ff ff       	call   80100217 <brelse>
}
801015bd:	83 c4 34             	add    $0x34,%esp
801015c0:	5b                   	pop    %ebx
801015c1:	5d                   	pop    %ebp
801015c2:	c3                   	ret    

801015c3 <iinit>:
  struct inode inode[NINODE];
} icache;

void
iinit(void)
{
801015c3:	55                   	push   %ebp
801015c4:	89 e5                	mov    %esp,%ebp
801015c6:	83 ec 18             	sub    $0x18,%esp
  initlock(&icache.lock, "icache");
801015c9:	c7 44 24 04 3a 89 10 	movl   $0x8010893a,0x4(%esp)
801015d0:	80 
801015d1:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
801015d8:	e8 4d 36 00 00       	call   80104c2a <initlock>
}
801015dd:	c9                   	leave  
801015de:	c3                   	ret    

801015df <ialloc>:
//PAGEBREAK!
// Allocate a new inode with the given type on device dev.
// A free inode has a type of zero.
struct inode*
ialloc(uint dev, short type)
{
801015df:	55                   	push   %ebp
801015e0:	89 e5                	mov    %esp,%ebp
801015e2:	83 ec 48             	sub    $0x48,%esp
801015e5:	8b 45 0c             	mov    0xc(%ebp),%eax
801015e8:	66 89 45 d4          	mov    %ax,-0x2c(%ebp)
  int inum;
  struct buf *bp;
  struct dinode *dip;
  struct superblock sb;

  readsb(dev, &sb);
801015ec:	8b 45 08             	mov    0x8(%ebp),%eax
801015ef:	8d 55 dc             	lea    -0x24(%ebp),%edx
801015f2:	89 54 24 04          	mov    %edx,0x4(%esp)
801015f6:	89 04 24             	mov    %eax,(%esp)
801015f9:	e8 fe fc ff ff       	call   801012fc <readsb>

  for(inum = 1; inum < sb.ninodes; inum++){
801015fe:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
80101605:	e9 98 00 00 00       	jmp    801016a2 <ialloc+0xc3>
    bp = bread(dev, IBLOCK(inum));
8010160a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010160d:	c1 e8 03             	shr    $0x3,%eax
80101610:	83 c0 02             	add    $0x2,%eax
80101613:	89 44 24 04          	mov    %eax,0x4(%esp)
80101617:	8b 45 08             	mov    0x8(%ebp),%eax
8010161a:	89 04 24             	mov    %eax,(%esp)
8010161d:	e8 84 eb ff ff       	call   801001a6 <bread>
80101622:	89 45 f0             	mov    %eax,-0x10(%ebp)
    dip = (struct dinode*)bp->data + inum%IPB;
80101625:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101628:	8d 50 18             	lea    0x18(%eax),%edx
8010162b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010162e:	83 e0 07             	and    $0x7,%eax
80101631:	c1 e0 06             	shl    $0x6,%eax
80101634:	01 d0                	add    %edx,%eax
80101636:	89 45 ec             	mov    %eax,-0x14(%ebp)
    if(dip->type == 0){  // a free inode
80101639:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010163c:	0f b7 00             	movzwl (%eax),%eax
8010163f:	66 85 c0             	test   %ax,%ax
80101642:	75 4f                	jne    80101693 <ialloc+0xb4>
      memset(dip, 0, sizeof(*dip));
80101644:	c7 44 24 08 40 00 00 	movl   $0x40,0x8(%esp)
8010164b:	00 
8010164c:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80101653:	00 
80101654:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101657:	89 04 24             	mov    %eax,(%esp)
8010165a:	e8 3b 38 00 00       	call   80104e9a <memset>
      dip->type = type;
8010165f:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101662:	0f b7 55 d4          	movzwl -0x2c(%ebp),%edx
80101666:	66 89 10             	mov    %dx,(%eax)
      log_write(bp);   // mark it allocated on the disk
80101669:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010166c:	89 04 24             	mov    %eax,(%esp)
8010166f:	e8 5e 1d 00 00       	call   801033d2 <log_write>
      brelse(bp);
80101674:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101677:	89 04 24             	mov    %eax,(%esp)
8010167a:	e8 98 eb ff ff       	call   80100217 <brelse>
      return iget(dev, inum);
8010167f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101682:	89 44 24 04          	mov    %eax,0x4(%esp)
80101686:	8b 45 08             	mov    0x8(%ebp),%eax
80101689:	89 04 24             	mov    %eax,(%esp)
8010168c:	e8 e3 00 00 00       	call   80101774 <iget>
    }
    brelse(bp);
  }
  panic("ialloc: no inodes");
}
80101691:	c9                   	leave  
80101692:	c3                   	ret    
      dip->type = type;
      log_write(bp);   // mark it allocated on the disk
      brelse(bp);
      return iget(dev, inum);
    }
    brelse(bp);
80101693:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101696:	89 04 24             	mov    %eax,(%esp)
80101699:	e8 79 eb ff ff       	call   80100217 <brelse>
  struct dinode *dip;
  struct superblock sb;

  readsb(dev, &sb);

  for(inum = 1; inum < sb.ninodes; inum++){
8010169e:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801016a2:	8b 55 f4             	mov    -0xc(%ebp),%edx
801016a5:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801016a8:	39 c2                	cmp    %eax,%edx
801016aa:	0f 82 5a ff ff ff    	jb     8010160a <ialloc+0x2b>
      brelse(bp);
      return iget(dev, inum);
    }
    brelse(bp);
  }
  panic("ialloc: no inodes");
801016b0:	c7 04 24 41 89 10 80 	movl   $0x80108941,(%esp)
801016b7:	e8 99 ee ff ff       	call   80100555 <panic>

801016bc <iupdate>:
}

// Copy a modified in-memory inode to disk.
void
iupdate(struct inode *ip)
{
801016bc:	55                   	push   %ebp
801016bd:	89 e5                	mov    %esp,%ebp
801016bf:	83 ec 28             	sub    $0x28,%esp
  struct buf *bp;
  struct dinode *dip;

  bp = bread(ip->dev, IBLOCK(ip->inum));
801016c2:	8b 45 08             	mov    0x8(%ebp),%eax
801016c5:	8b 40 04             	mov    0x4(%eax),%eax
801016c8:	c1 e8 03             	shr    $0x3,%eax
801016cb:	8d 50 02             	lea    0x2(%eax),%edx
801016ce:	8b 45 08             	mov    0x8(%ebp),%eax
801016d1:	8b 00                	mov    (%eax),%eax
801016d3:	89 54 24 04          	mov    %edx,0x4(%esp)
801016d7:	89 04 24             	mov    %eax,(%esp)
801016da:	e8 c7 ea ff ff       	call   801001a6 <bread>
801016df:	89 45 f4             	mov    %eax,-0xc(%ebp)
  dip = (struct dinode*)bp->data + ip->inum%IPB;
801016e2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801016e5:	8d 50 18             	lea    0x18(%eax),%edx
801016e8:	8b 45 08             	mov    0x8(%ebp),%eax
801016eb:	8b 40 04             	mov    0x4(%eax),%eax
801016ee:	83 e0 07             	and    $0x7,%eax
801016f1:	c1 e0 06             	shl    $0x6,%eax
801016f4:	01 d0                	add    %edx,%eax
801016f6:	89 45 f0             	mov    %eax,-0x10(%ebp)
  dip->type = ip->type;
801016f9:	8b 45 08             	mov    0x8(%ebp),%eax
801016fc:	0f b7 50 10          	movzwl 0x10(%eax),%edx
80101700:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101703:	66 89 10             	mov    %dx,(%eax)
  dip->major = ip->major;
80101706:	8b 45 08             	mov    0x8(%ebp),%eax
80101709:	0f b7 50 12          	movzwl 0x12(%eax),%edx
8010170d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101710:	66 89 50 02          	mov    %dx,0x2(%eax)
  dip->minor = ip->minor;
80101714:	8b 45 08             	mov    0x8(%ebp),%eax
80101717:	0f b7 50 14          	movzwl 0x14(%eax),%edx
8010171b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010171e:	66 89 50 04          	mov    %dx,0x4(%eax)
  dip->nlink = ip->nlink;
80101722:	8b 45 08             	mov    0x8(%ebp),%eax
80101725:	0f b7 50 16          	movzwl 0x16(%eax),%edx
80101729:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010172c:	66 89 50 06          	mov    %dx,0x6(%eax)
  dip->size = ip->size;
80101730:	8b 45 08             	mov    0x8(%ebp),%eax
80101733:	8b 50 18             	mov    0x18(%eax),%edx
80101736:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101739:	89 50 08             	mov    %edx,0x8(%eax)
  memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
8010173c:	8b 45 08             	mov    0x8(%ebp),%eax
8010173f:	8d 50 1c             	lea    0x1c(%eax),%edx
80101742:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101745:	83 c0 0c             	add    $0xc,%eax
80101748:	c7 44 24 08 34 00 00 	movl   $0x34,0x8(%esp)
8010174f:	00 
80101750:	89 54 24 04          	mov    %edx,0x4(%esp)
80101754:	89 04 24             	mov    %eax,(%esp)
80101757:	e8 11 38 00 00       	call   80104f6d <memmove>
  log_write(bp);
8010175c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010175f:	89 04 24             	mov    %eax,(%esp)
80101762:	e8 6b 1c 00 00       	call   801033d2 <log_write>
  brelse(bp);
80101767:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010176a:	89 04 24             	mov    %eax,(%esp)
8010176d:	e8 a5 ea ff ff       	call   80100217 <brelse>
}
80101772:	c9                   	leave  
80101773:	c3                   	ret    

80101774 <iget>:
// Find the inode with number inum on device dev
// and return the in-memory copy. Does not lock
// the inode and does not read it from disk.
static struct inode*
iget(uint dev, uint inum)
{
80101774:	55                   	push   %ebp
80101775:	89 e5                	mov    %esp,%ebp
80101777:	83 ec 28             	sub    $0x28,%esp
  struct inode *ip, *empty;

  acquire(&icache.lock);
8010177a:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
80101781:	e8 c5 34 00 00       	call   80104c4b <acquire>

  // Is the inode already cached?
  empty = 0;
80101786:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
  for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010178d:	c7 45 f4 94 f8 10 80 	movl   $0x8010f894,-0xc(%ebp)
80101794:	eb 59                	jmp    801017ef <iget+0x7b>
    if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
80101796:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101799:	8b 40 08             	mov    0x8(%eax),%eax
8010179c:	85 c0                	test   %eax,%eax
8010179e:	7e 35                	jle    801017d5 <iget+0x61>
801017a0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017a3:	8b 00                	mov    (%eax),%eax
801017a5:	3b 45 08             	cmp    0x8(%ebp),%eax
801017a8:	75 2b                	jne    801017d5 <iget+0x61>
801017aa:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017ad:	8b 40 04             	mov    0x4(%eax),%eax
801017b0:	3b 45 0c             	cmp    0xc(%ebp),%eax
801017b3:	75 20                	jne    801017d5 <iget+0x61>
      ip->ref++;
801017b5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017b8:	8b 40 08             	mov    0x8(%eax),%eax
801017bb:	8d 50 01             	lea    0x1(%eax),%edx
801017be:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017c1:	89 50 08             	mov    %edx,0x8(%eax)
      release(&icache.lock);
801017c4:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
801017cb:	e8 dd 34 00 00       	call   80104cad <release>
      return ip;
801017d0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017d3:	eb 6f                	jmp    80101844 <iget+0xd0>
    }
    if(empty == 0 && ip->ref == 0)    // Remember empty slot.
801017d5:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801017d9:	75 10                	jne    801017eb <iget+0x77>
801017db:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017de:	8b 40 08             	mov    0x8(%eax),%eax
801017e1:	85 c0                	test   %eax,%eax
801017e3:	75 06                	jne    801017eb <iget+0x77>
      empty = ip;
801017e5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017e8:	89 45 f0             	mov    %eax,-0x10(%ebp)

  acquire(&icache.lock);

  // Is the inode already cached?
  empty = 0;
  for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
801017eb:	83 45 f4 50          	addl   $0x50,-0xc(%ebp)
801017ef:	81 7d f4 34 08 11 80 	cmpl   $0x80110834,-0xc(%ebp)
801017f6:	72 9e                	jb     80101796 <iget+0x22>
    if(empty == 0 && ip->ref == 0)    // Remember empty slot.
      empty = ip;
  }

  // Recycle an inode cache entry.
  if(empty == 0)
801017f8:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801017fc:	75 0c                	jne    8010180a <iget+0x96>
    panic("iget: no inodes");
801017fe:	c7 04 24 53 89 10 80 	movl   $0x80108953,(%esp)
80101805:	e8 4b ed ff ff       	call   80100555 <panic>

  ip = empty;
8010180a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010180d:	89 45 f4             	mov    %eax,-0xc(%ebp)
  ip->dev = dev;
80101810:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101813:	8b 55 08             	mov    0x8(%ebp),%edx
80101816:	89 10                	mov    %edx,(%eax)
  ip->inum = inum;
80101818:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010181b:	8b 55 0c             	mov    0xc(%ebp),%edx
8010181e:	89 50 04             	mov    %edx,0x4(%eax)
  ip->ref = 1;
80101821:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101824:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
  ip->flags = 0;
8010182b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010182e:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
  release(&icache.lock);
80101835:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
8010183c:	e8 6c 34 00 00       	call   80104cad <release>

  return ip;
80101841:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80101844:	c9                   	leave  
80101845:	c3                   	ret    

80101846 <idup>:

// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
80101846:	55                   	push   %ebp
80101847:	89 e5                	mov    %esp,%ebp
80101849:	83 ec 18             	sub    $0x18,%esp
  acquire(&icache.lock);
8010184c:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
80101853:	e8 f3 33 00 00       	call   80104c4b <acquire>
  ip->ref++;
80101858:	8b 45 08             	mov    0x8(%ebp),%eax
8010185b:	8b 40 08             	mov    0x8(%eax),%eax
8010185e:	8d 50 01             	lea    0x1(%eax),%edx
80101861:	8b 45 08             	mov    0x8(%ebp),%eax
80101864:	89 50 08             	mov    %edx,0x8(%eax)
  release(&icache.lock);
80101867:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
8010186e:	e8 3a 34 00 00       	call   80104cad <release>
  return ip;
80101873:	8b 45 08             	mov    0x8(%ebp),%eax
}
80101876:	c9                   	leave  
80101877:	c3                   	ret    

80101878 <ilock>:

// Lock the given inode.
// Reads the inode from disk if necessary.
void
ilock(struct inode *ip)
{
80101878:	55                   	push   %ebp
80101879:	89 e5                	mov    %esp,%ebp
8010187b:	83 ec 28             	sub    $0x28,%esp
  struct buf *bp;
  struct dinode *dip;

  if(ip == 0 || ip->ref < 1)
8010187e:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80101882:	74 0a                	je     8010188e <ilock+0x16>
80101884:	8b 45 08             	mov    0x8(%ebp),%eax
80101887:	8b 40 08             	mov    0x8(%eax),%eax
8010188a:	85 c0                	test   %eax,%eax
8010188c:	7f 0c                	jg     8010189a <ilock+0x22>
    panic("ilock");
8010188e:	c7 04 24 63 89 10 80 	movl   $0x80108963,(%esp)
80101895:	e8 bb ec ff ff       	call   80100555 <panic>

  acquire(&icache.lock);
8010189a:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
801018a1:	e8 a5 33 00 00       	call   80104c4b <acquire>
  while(ip->flags & I_BUSY)
801018a6:	eb 13                	jmp    801018bb <ilock+0x43>
    sleep(ip, &icache.lock);
801018a8:	c7 44 24 04 60 f8 10 	movl   $0x8010f860,0x4(%esp)
801018af:	80 
801018b0:	8b 45 08             	mov    0x8(%ebp),%eax
801018b3:	89 04 24             	mov    %eax,(%esp)
801018b6:	e8 ce 30 00 00       	call   80104989 <sleep>

  if(ip == 0 || ip->ref < 1)
    panic("ilock");

  acquire(&icache.lock);
  while(ip->flags & I_BUSY)
801018bb:	8b 45 08             	mov    0x8(%ebp),%eax
801018be:	8b 40 0c             	mov    0xc(%eax),%eax
801018c1:	83 e0 01             	and    $0x1,%eax
801018c4:	84 c0                	test   %al,%al
801018c6:	75 e0                	jne    801018a8 <ilock+0x30>
    sleep(ip, &icache.lock);
  ip->flags |= I_BUSY;
801018c8:	8b 45 08             	mov    0x8(%ebp),%eax
801018cb:	8b 40 0c             	mov    0xc(%eax),%eax
801018ce:	89 c2                	mov    %eax,%edx
801018d0:	83 ca 01             	or     $0x1,%edx
801018d3:	8b 45 08             	mov    0x8(%ebp),%eax
801018d6:	89 50 0c             	mov    %edx,0xc(%eax)
  release(&icache.lock);
801018d9:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
801018e0:	e8 c8 33 00 00       	call   80104cad <release>

  if(!(ip->flags & I_VALID)){
801018e5:	8b 45 08             	mov    0x8(%ebp),%eax
801018e8:	8b 40 0c             	mov    0xc(%eax),%eax
801018eb:	83 e0 02             	and    $0x2,%eax
801018ee:	85 c0                	test   %eax,%eax
801018f0:	0f 85 ce 00 00 00    	jne    801019c4 <ilock+0x14c>
    bp = bread(ip->dev, IBLOCK(ip->inum));
801018f6:	8b 45 08             	mov    0x8(%ebp),%eax
801018f9:	8b 40 04             	mov    0x4(%eax),%eax
801018fc:	c1 e8 03             	shr    $0x3,%eax
801018ff:	8d 50 02             	lea    0x2(%eax),%edx
80101902:	8b 45 08             	mov    0x8(%ebp),%eax
80101905:	8b 00                	mov    (%eax),%eax
80101907:	89 54 24 04          	mov    %edx,0x4(%esp)
8010190b:	89 04 24             	mov    %eax,(%esp)
8010190e:	e8 93 e8 ff ff       	call   801001a6 <bread>
80101913:	89 45 f4             	mov    %eax,-0xc(%ebp)
    dip = (struct dinode*)bp->data + ip->inum%IPB;
80101916:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101919:	8d 50 18             	lea    0x18(%eax),%edx
8010191c:	8b 45 08             	mov    0x8(%ebp),%eax
8010191f:	8b 40 04             	mov    0x4(%eax),%eax
80101922:	83 e0 07             	and    $0x7,%eax
80101925:	c1 e0 06             	shl    $0x6,%eax
80101928:	01 d0                	add    %edx,%eax
8010192a:	89 45 f0             	mov    %eax,-0x10(%ebp)
    ip->type = dip->type;
8010192d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101930:	0f b7 10             	movzwl (%eax),%edx
80101933:	8b 45 08             	mov    0x8(%ebp),%eax
80101936:	66 89 50 10          	mov    %dx,0x10(%eax)
    ip->major = dip->major;
8010193a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010193d:	0f b7 50 02          	movzwl 0x2(%eax),%edx
80101941:	8b 45 08             	mov    0x8(%ebp),%eax
80101944:	66 89 50 12          	mov    %dx,0x12(%eax)
    ip->minor = dip->minor;
80101948:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010194b:	0f b7 50 04          	movzwl 0x4(%eax),%edx
8010194f:	8b 45 08             	mov    0x8(%ebp),%eax
80101952:	66 89 50 14          	mov    %dx,0x14(%eax)
    ip->nlink = dip->nlink;
80101956:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101959:	0f b7 50 06          	movzwl 0x6(%eax),%edx
8010195d:	8b 45 08             	mov    0x8(%ebp),%eax
80101960:	66 89 50 16          	mov    %dx,0x16(%eax)
    ip->size = dip->size;
80101964:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101967:	8b 50 08             	mov    0x8(%eax),%edx
8010196a:	8b 45 08             	mov    0x8(%ebp),%eax
8010196d:	89 50 18             	mov    %edx,0x18(%eax)
    memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
80101970:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101973:	8d 50 0c             	lea    0xc(%eax),%edx
80101976:	8b 45 08             	mov    0x8(%ebp),%eax
80101979:	83 c0 1c             	add    $0x1c,%eax
8010197c:	c7 44 24 08 34 00 00 	movl   $0x34,0x8(%esp)
80101983:	00 
80101984:	89 54 24 04          	mov    %edx,0x4(%esp)
80101988:	89 04 24             	mov    %eax,(%esp)
8010198b:	e8 dd 35 00 00       	call   80104f6d <memmove>
    brelse(bp);
80101990:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101993:	89 04 24             	mov    %eax,(%esp)
80101996:	e8 7c e8 ff ff       	call   80100217 <brelse>
    ip->flags |= I_VALID;
8010199b:	8b 45 08             	mov    0x8(%ebp),%eax
8010199e:	8b 40 0c             	mov    0xc(%eax),%eax
801019a1:	89 c2                	mov    %eax,%edx
801019a3:	83 ca 02             	or     $0x2,%edx
801019a6:	8b 45 08             	mov    0x8(%ebp),%eax
801019a9:	89 50 0c             	mov    %edx,0xc(%eax)
    if(ip->type == 0)
801019ac:	8b 45 08             	mov    0x8(%ebp),%eax
801019af:	0f b7 40 10          	movzwl 0x10(%eax),%eax
801019b3:	66 85 c0             	test   %ax,%ax
801019b6:	75 0c                	jne    801019c4 <ilock+0x14c>
      panic("ilock: no type");
801019b8:	c7 04 24 69 89 10 80 	movl   $0x80108969,(%esp)
801019bf:	e8 91 eb ff ff       	call   80100555 <panic>
  }
}
801019c4:	c9                   	leave  
801019c5:	c3                   	ret    

801019c6 <iunlock>:

// Unlock the given inode.
void
iunlock(struct inode *ip)
{
801019c6:	55                   	push   %ebp
801019c7:	89 e5                	mov    %esp,%ebp
801019c9:	83 ec 18             	sub    $0x18,%esp
  if(ip == 0 || !(ip->flags & I_BUSY) || ip->ref < 1)
801019cc:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
801019d0:	74 17                	je     801019e9 <iunlock+0x23>
801019d2:	8b 45 08             	mov    0x8(%ebp),%eax
801019d5:	8b 40 0c             	mov    0xc(%eax),%eax
801019d8:	83 e0 01             	and    $0x1,%eax
801019db:	85 c0                	test   %eax,%eax
801019dd:	74 0a                	je     801019e9 <iunlock+0x23>
801019df:	8b 45 08             	mov    0x8(%ebp),%eax
801019e2:	8b 40 08             	mov    0x8(%eax),%eax
801019e5:	85 c0                	test   %eax,%eax
801019e7:	7f 0c                	jg     801019f5 <iunlock+0x2f>
    panic("iunlock");
801019e9:	c7 04 24 78 89 10 80 	movl   $0x80108978,(%esp)
801019f0:	e8 60 eb ff ff       	call   80100555 <panic>

  acquire(&icache.lock);
801019f5:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
801019fc:	e8 4a 32 00 00       	call   80104c4b <acquire>
  ip->flags &= ~I_BUSY;
80101a01:	8b 45 08             	mov    0x8(%ebp),%eax
80101a04:	8b 40 0c             	mov    0xc(%eax),%eax
80101a07:	89 c2                	mov    %eax,%edx
80101a09:	83 e2 fe             	and    $0xfffffffe,%edx
80101a0c:	8b 45 08             	mov    0x8(%ebp),%eax
80101a0f:	89 50 0c             	mov    %edx,0xc(%eax)
  wakeup(ip);
80101a12:	8b 45 08             	mov    0x8(%ebp),%eax
80101a15:	89 04 24             	mov    %eax,(%esp)
80101a18:	e8 45 30 00 00       	call   80104a62 <wakeup>
  release(&icache.lock);
80101a1d:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
80101a24:	e8 84 32 00 00       	call   80104cad <release>
}
80101a29:	c9                   	leave  
80101a2a:	c3                   	ret    

80101a2b <iput>:
// be recycled.
// If that was the last reference and the inode has no links
// to it, free the inode (and its content) on disk.
void
iput(struct inode *ip)
{
80101a2b:	55                   	push   %ebp
80101a2c:	89 e5                	mov    %esp,%ebp
80101a2e:	83 ec 18             	sub    $0x18,%esp
  acquire(&icache.lock);
80101a31:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
80101a38:	e8 0e 32 00 00       	call   80104c4b <acquire>
  if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
80101a3d:	8b 45 08             	mov    0x8(%ebp),%eax
80101a40:	8b 40 08             	mov    0x8(%eax),%eax
80101a43:	83 f8 01             	cmp    $0x1,%eax
80101a46:	0f 85 93 00 00 00    	jne    80101adf <iput+0xb4>
80101a4c:	8b 45 08             	mov    0x8(%ebp),%eax
80101a4f:	8b 40 0c             	mov    0xc(%eax),%eax
80101a52:	83 e0 02             	and    $0x2,%eax
80101a55:	85 c0                	test   %eax,%eax
80101a57:	0f 84 82 00 00 00    	je     80101adf <iput+0xb4>
80101a5d:	8b 45 08             	mov    0x8(%ebp),%eax
80101a60:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80101a64:	66 85 c0             	test   %ax,%ax
80101a67:	75 76                	jne    80101adf <iput+0xb4>
    // inode has no links: truncate and free inode.
    if(ip->flags & I_BUSY)
80101a69:	8b 45 08             	mov    0x8(%ebp),%eax
80101a6c:	8b 40 0c             	mov    0xc(%eax),%eax
80101a6f:	83 e0 01             	and    $0x1,%eax
80101a72:	84 c0                	test   %al,%al
80101a74:	74 0c                	je     80101a82 <iput+0x57>
      panic("iput busy");
80101a76:	c7 04 24 80 89 10 80 	movl   $0x80108980,(%esp)
80101a7d:	e8 d3 ea ff ff       	call   80100555 <panic>
    ip->flags |= I_BUSY;
80101a82:	8b 45 08             	mov    0x8(%ebp),%eax
80101a85:	8b 40 0c             	mov    0xc(%eax),%eax
80101a88:	89 c2                	mov    %eax,%edx
80101a8a:	83 ca 01             	or     $0x1,%edx
80101a8d:	8b 45 08             	mov    0x8(%ebp),%eax
80101a90:	89 50 0c             	mov    %edx,0xc(%eax)
    release(&icache.lock);
80101a93:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
80101a9a:	e8 0e 32 00 00       	call   80104cad <release>
    itrunc(ip);
80101a9f:	8b 45 08             	mov    0x8(%ebp),%eax
80101aa2:	89 04 24             	mov    %eax,(%esp)
80101aa5:	e8 72 01 00 00       	call   80101c1c <itrunc>
    ip->type = 0;
80101aaa:	8b 45 08             	mov    0x8(%ebp),%eax
80101aad:	66 c7 40 10 00 00    	movw   $0x0,0x10(%eax)
    iupdate(ip);
80101ab3:	8b 45 08             	mov    0x8(%ebp),%eax
80101ab6:	89 04 24             	mov    %eax,(%esp)
80101ab9:	e8 fe fb ff ff       	call   801016bc <iupdate>
    acquire(&icache.lock);
80101abe:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
80101ac5:	e8 81 31 00 00       	call   80104c4b <acquire>
    ip->flags = 0;
80101aca:	8b 45 08             	mov    0x8(%ebp),%eax
80101acd:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    wakeup(ip);
80101ad4:	8b 45 08             	mov    0x8(%ebp),%eax
80101ad7:	89 04 24             	mov    %eax,(%esp)
80101ada:	e8 83 2f 00 00       	call   80104a62 <wakeup>
  }
  ip->ref--;
80101adf:	8b 45 08             	mov    0x8(%ebp),%eax
80101ae2:	8b 40 08             	mov    0x8(%eax),%eax
80101ae5:	8d 50 ff             	lea    -0x1(%eax),%edx
80101ae8:	8b 45 08             	mov    0x8(%ebp),%eax
80101aeb:	89 50 08             	mov    %edx,0x8(%eax)
  release(&icache.lock);
80101aee:	c7 04 24 60 f8 10 80 	movl   $0x8010f860,(%esp)
80101af5:	e8 b3 31 00 00       	call   80104cad <release>
}
80101afa:	c9                   	leave  
80101afb:	c3                   	ret    

80101afc <iunlockput>:

// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
80101afc:	55                   	push   %ebp
80101afd:	89 e5                	mov    %esp,%ebp
80101aff:	83 ec 18             	sub    $0x18,%esp
  iunlock(ip);
80101b02:	8b 45 08             	mov    0x8(%ebp),%eax
80101b05:	89 04 24             	mov    %eax,(%esp)
80101b08:	e8 b9 fe ff ff       	call   801019c6 <iunlock>
  iput(ip);
80101b0d:	8b 45 08             	mov    0x8(%ebp),%eax
80101b10:	89 04 24             	mov    %eax,(%esp)
80101b13:	e8 13 ff ff ff       	call   80101a2b <iput>
}
80101b18:	c9                   	leave  
80101b19:	c3                   	ret    

80101b1a <bmap>:

// Return the disk block address of the nth block in inode ip.
// If there is no such block, bmap allocates one.
static uint
bmap(struct inode *ip, uint bn)
{
80101b1a:	55                   	push   %ebp
80101b1b:	89 e5                	mov    %esp,%ebp
80101b1d:	53                   	push   %ebx
80101b1e:	83 ec 24             	sub    $0x24,%esp
  uint addr, *a;
  struct buf *bp;

  if(bn < NDIRECT){
80101b21:	83 7d 0c 0b          	cmpl   $0xb,0xc(%ebp)
80101b25:	77 3e                	ja     80101b65 <bmap+0x4b>
    if((addr = ip->addrs[bn]) == 0)
80101b27:	8b 45 08             	mov    0x8(%ebp),%eax
80101b2a:	8b 55 0c             	mov    0xc(%ebp),%edx
80101b2d:	83 c2 04             	add    $0x4,%edx
80101b30:	8b 44 90 0c          	mov    0xc(%eax,%edx,4),%eax
80101b34:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101b37:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101b3b:	75 20                	jne    80101b5d <bmap+0x43>
      ip->addrs[bn] = addr = balloc(ip->dev);
80101b3d:	8b 45 08             	mov    0x8(%ebp),%eax
80101b40:	8b 00                	mov    (%eax),%eax
80101b42:	89 04 24             	mov    %eax,(%esp)
80101b45:	e8 49 f8 ff ff       	call   80101393 <balloc>
80101b4a:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101b4d:	8b 45 08             	mov    0x8(%ebp),%eax
80101b50:	8b 55 0c             	mov    0xc(%ebp),%edx
80101b53:	8d 4a 04             	lea    0x4(%edx),%ecx
80101b56:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101b59:	89 54 88 0c          	mov    %edx,0xc(%eax,%ecx,4)
    return addr;
80101b5d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101b60:	e9 b1 00 00 00       	jmp    80101c16 <bmap+0xfc>
  }
  bn -= NDIRECT;
80101b65:	83 6d 0c 0c          	subl   $0xc,0xc(%ebp)

  if(bn < NINDIRECT){
80101b69:	83 7d 0c 7f          	cmpl   $0x7f,0xc(%ebp)
80101b6d:	0f 87 97 00 00 00    	ja     80101c0a <bmap+0xf0>
    // Load indirect block, allocating if necessary.
    if((addr = ip->addrs[NDIRECT]) == 0)
80101b73:	8b 45 08             	mov    0x8(%ebp),%eax
80101b76:	8b 40 4c             	mov    0x4c(%eax),%eax
80101b79:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101b7c:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101b80:	75 19                	jne    80101b9b <bmap+0x81>
      ip->addrs[NDIRECT] = addr = balloc(ip->dev);
80101b82:	8b 45 08             	mov    0x8(%ebp),%eax
80101b85:	8b 00                	mov    (%eax),%eax
80101b87:	89 04 24             	mov    %eax,(%esp)
80101b8a:	e8 04 f8 ff ff       	call   80101393 <balloc>
80101b8f:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101b92:	8b 45 08             	mov    0x8(%ebp),%eax
80101b95:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101b98:	89 50 4c             	mov    %edx,0x4c(%eax)
    bp = bread(ip->dev, addr);
80101b9b:	8b 45 08             	mov    0x8(%ebp),%eax
80101b9e:	8b 00                	mov    (%eax),%eax
80101ba0:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101ba3:	89 54 24 04          	mov    %edx,0x4(%esp)
80101ba7:	89 04 24             	mov    %eax,(%esp)
80101baa:	e8 f7 e5 ff ff       	call   801001a6 <bread>
80101baf:	89 45 f0             	mov    %eax,-0x10(%ebp)
    a = (uint*)bp->data;
80101bb2:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101bb5:	83 c0 18             	add    $0x18,%eax
80101bb8:	89 45 ec             	mov    %eax,-0x14(%ebp)
    if((addr = a[bn]) == 0){
80101bbb:	8b 45 0c             	mov    0xc(%ebp),%eax
80101bbe:	c1 e0 02             	shl    $0x2,%eax
80101bc1:	03 45 ec             	add    -0x14(%ebp),%eax
80101bc4:	8b 00                	mov    (%eax),%eax
80101bc6:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101bc9:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101bcd:	75 2b                	jne    80101bfa <bmap+0xe0>
      a[bn] = addr = balloc(ip->dev);
80101bcf:	8b 45 0c             	mov    0xc(%ebp),%eax
80101bd2:	c1 e0 02             	shl    $0x2,%eax
80101bd5:	89 c3                	mov    %eax,%ebx
80101bd7:	03 5d ec             	add    -0x14(%ebp),%ebx
80101bda:	8b 45 08             	mov    0x8(%ebp),%eax
80101bdd:	8b 00                	mov    (%eax),%eax
80101bdf:	89 04 24             	mov    %eax,(%esp)
80101be2:	e8 ac f7 ff ff       	call   80101393 <balloc>
80101be7:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101bea:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101bed:	89 03                	mov    %eax,(%ebx)
      log_write(bp);
80101bef:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101bf2:	89 04 24             	mov    %eax,(%esp)
80101bf5:	e8 d8 17 00 00       	call   801033d2 <log_write>
    }
    brelse(bp);
80101bfa:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101bfd:	89 04 24             	mov    %eax,(%esp)
80101c00:	e8 12 e6 ff ff       	call   80100217 <brelse>
    return addr;
80101c05:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101c08:	eb 0c                	jmp    80101c16 <bmap+0xfc>
  }

  panic("bmap: out of range");
80101c0a:	c7 04 24 8a 89 10 80 	movl   $0x8010898a,(%esp)
80101c11:	e8 3f e9 ff ff       	call   80100555 <panic>
}
80101c16:	83 c4 24             	add    $0x24,%esp
80101c19:	5b                   	pop    %ebx
80101c1a:	5d                   	pop    %ebp
80101c1b:	c3                   	ret    

80101c1c <itrunc>:
// to it (no directory entries referring to it)
// and has no in-memory reference to it (is
// not an open file or current directory).
static void
itrunc(struct inode *ip)
{
80101c1c:	55                   	push   %ebp
80101c1d:	89 e5                	mov    %esp,%ebp
80101c1f:	83 ec 28             	sub    $0x28,%esp
  int i, j;
  struct buf *bp;
  uint *a;

  for(i = 0; i < NDIRECT; i++){
80101c22:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80101c29:	eb 44                	jmp    80101c6f <itrunc+0x53>
    if(ip->addrs[i]){
80101c2b:	8b 45 08             	mov    0x8(%ebp),%eax
80101c2e:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101c31:	83 c2 04             	add    $0x4,%edx
80101c34:	8b 44 90 0c          	mov    0xc(%eax,%edx,4),%eax
80101c38:	85 c0                	test   %eax,%eax
80101c3a:	74 2f                	je     80101c6b <itrunc+0x4f>
      bfree(ip->dev, ip->addrs[i]);
80101c3c:	8b 45 08             	mov    0x8(%ebp),%eax
80101c3f:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101c42:	83 c2 04             	add    $0x4,%edx
80101c45:	8b 54 90 0c          	mov    0xc(%eax,%edx,4),%edx
80101c49:	8b 45 08             	mov    0x8(%ebp),%eax
80101c4c:	8b 00                	mov    (%eax),%eax
80101c4e:	89 54 24 04          	mov    %edx,0x4(%esp)
80101c52:	89 04 24             	mov    %eax,(%esp)
80101c55:	e8 90 f8 ff ff       	call   801014ea <bfree>
      ip->addrs[i] = 0;
80101c5a:	8b 45 08             	mov    0x8(%ebp),%eax
80101c5d:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101c60:	83 c2 04             	add    $0x4,%edx
80101c63:	c7 44 90 0c 00 00 00 	movl   $0x0,0xc(%eax,%edx,4)
80101c6a:	00 
{
  int i, j;
  struct buf *bp;
  uint *a;

  for(i = 0; i < NDIRECT; i++){
80101c6b:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80101c6f:	83 7d f4 0b          	cmpl   $0xb,-0xc(%ebp)
80101c73:	7e b6                	jle    80101c2b <itrunc+0xf>
      bfree(ip->dev, ip->addrs[i]);
      ip->addrs[i] = 0;
    }
  }
  
  if(ip->addrs[NDIRECT]){
80101c75:	8b 45 08             	mov    0x8(%ebp),%eax
80101c78:	8b 40 4c             	mov    0x4c(%eax),%eax
80101c7b:	85 c0                	test   %eax,%eax
80101c7d:	0f 84 8f 00 00 00    	je     80101d12 <itrunc+0xf6>
    bp = bread(ip->dev, ip->addrs[NDIRECT]);
80101c83:	8b 45 08             	mov    0x8(%ebp),%eax
80101c86:	8b 50 4c             	mov    0x4c(%eax),%edx
80101c89:	8b 45 08             	mov    0x8(%ebp),%eax
80101c8c:	8b 00                	mov    (%eax),%eax
80101c8e:	89 54 24 04          	mov    %edx,0x4(%esp)
80101c92:	89 04 24             	mov    %eax,(%esp)
80101c95:	e8 0c e5 ff ff       	call   801001a6 <bread>
80101c9a:	89 45 ec             	mov    %eax,-0x14(%ebp)
    a = (uint*)bp->data;
80101c9d:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101ca0:	83 c0 18             	add    $0x18,%eax
80101ca3:	89 45 e8             	mov    %eax,-0x18(%ebp)
    for(j = 0; j < NINDIRECT; j++){
80101ca6:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
80101cad:	eb 2f                	jmp    80101cde <itrunc+0xc2>
      if(a[j])
80101caf:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101cb2:	c1 e0 02             	shl    $0x2,%eax
80101cb5:	03 45 e8             	add    -0x18(%ebp),%eax
80101cb8:	8b 00                	mov    (%eax),%eax
80101cba:	85 c0                	test   %eax,%eax
80101cbc:	74 1c                	je     80101cda <itrunc+0xbe>
        bfree(ip->dev, a[j]);
80101cbe:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101cc1:	c1 e0 02             	shl    $0x2,%eax
80101cc4:	03 45 e8             	add    -0x18(%ebp),%eax
80101cc7:	8b 10                	mov    (%eax),%edx
80101cc9:	8b 45 08             	mov    0x8(%ebp),%eax
80101ccc:	8b 00                	mov    (%eax),%eax
80101cce:	89 54 24 04          	mov    %edx,0x4(%esp)
80101cd2:	89 04 24             	mov    %eax,(%esp)
80101cd5:	e8 10 f8 ff ff       	call   801014ea <bfree>
  }
  
  if(ip->addrs[NDIRECT]){
    bp = bread(ip->dev, ip->addrs[NDIRECT]);
    a = (uint*)bp->data;
    for(j = 0; j < NINDIRECT; j++){
80101cda:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
80101cde:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101ce1:	83 f8 7f             	cmp    $0x7f,%eax
80101ce4:	76 c9                	jbe    80101caf <itrunc+0x93>
      if(a[j])
        bfree(ip->dev, a[j]);
    }
    brelse(bp);
80101ce6:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101ce9:	89 04 24             	mov    %eax,(%esp)
80101cec:	e8 26 e5 ff ff       	call   80100217 <brelse>
    bfree(ip->dev, ip->addrs[NDIRECT]);
80101cf1:	8b 45 08             	mov    0x8(%ebp),%eax
80101cf4:	8b 50 4c             	mov    0x4c(%eax),%edx
80101cf7:	8b 45 08             	mov    0x8(%ebp),%eax
80101cfa:	8b 00                	mov    (%eax),%eax
80101cfc:	89 54 24 04          	mov    %edx,0x4(%esp)
80101d00:	89 04 24             	mov    %eax,(%esp)
80101d03:	e8 e2 f7 ff ff       	call   801014ea <bfree>
    ip->addrs[NDIRECT] = 0;
80101d08:	8b 45 08             	mov    0x8(%ebp),%eax
80101d0b:	c7 40 4c 00 00 00 00 	movl   $0x0,0x4c(%eax)
  }

  ip->size = 0;
80101d12:	8b 45 08             	mov    0x8(%ebp),%eax
80101d15:	c7 40 18 00 00 00 00 	movl   $0x0,0x18(%eax)
  iupdate(ip);
80101d1c:	8b 45 08             	mov    0x8(%ebp),%eax
80101d1f:	89 04 24             	mov    %eax,(%esp)
80101d22:	e8 95 f9 ff ff       	call   801016bc <iupdate>
}
80101d27:	c9                   	leave  
80101d28:	c3                   	ret    

80101d29 <stati>:

// Copy stat information from inode.
void
stati(struct inode *ip, struct stat *st)
{
80101d29:	55                   	push   %ebp
80101d2a:	89 e5                	mov    %esp,%ebp
  st->dev = ip->dev;
80101d2c:	8b 45 08             	mov    0x8(%ebp),%eax
80101d2f:	8b 00                	mov    (%eax),%eax
80101d31:	89 c2                	mov    %eax,%edx
80101d33:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d36:	89 50 04             	mov    %edx,0x4(%eax)
  st->ino = ip->inum;
80101d39:	8b 45 08             	mov    0x8(%ebp),%eax
80101d3c:	8b 50 04             	mov    0x4(%eax),%edx
80101d3f:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d42:	89 50 08             	mov    %edx,0x8(%eax)
  st->type = ip->type;
80101d45:	8b 45 08             	mov    0x8(%ebp),%eax
80101d48:	0f b7 50 10          	movzwl 0x10(%eax),%edx
80101d4c:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d4f:	66 89 10             	mov    %dx,(%eax)
  st->nlink = ip->nlink;
80101d52:	8b 45 08             	mov    0x8(%ebp),%eax
80101d55:	0f b7 50 16          	movzwl 0x16(%eax),%edx
80101d59:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d5c:	66 89 50 0c          	mov    %dx,0xc(%eax)
  st->size = ip->size;
80101d60:	8b 45 08             	mov    0x8(%ebp),%eax
80101d63:	8b 50 18             	mov    0x18(%eax),%edx
80101d66:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d69:	89 50 10             	mov    %edx,0x10(%eax)
}
80101d6c:	5d                   	pop    %ebp
80101d6d:	c3                   	ret    

80101d6e <readi>:

//PAGEBREAK!
// Read data from inode.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
80101d6e:	55                   	push   %ebp
80101d6f:	89 e5                	mov    %esp,%ebp
80101d71:	53                   	push   %ebx
80101d72:	83 ec 24             	sub    $0x24,%esp
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
80101d75:	8b 45 08             	mov    0x8(%ebp),%eax
80101d78:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80101d7c:	66 83 f8 03          	cmp    $0x3,%ax
80101d80:	75 60                	jne    80101de2 <readi+0x74>
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
80101d82:	8b 45 08             	mov    0x8(%ebp),%eax
80101d85:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101d89:	66 85 c0             	test   %ax,%ax
80101d8c:	78 20                	js     80101dae <readi+0x40>
80101d8e:	8b 45 08             	mov    0x8(%ebp),%eax
80101d91:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101d95:	66 83 f8 09          	cmp    $0x9,%ax
80101d99:	7f 13                	jg     80101dae <readi+0x40>
80101d9b:	8b 45 08             	mov    0x8(%ebp),%eax
80101d9e:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101da2:	98                   	cwtl   
80101da3:	8b 04 c5 00 f8 10 80 	mov    -0x7fef0800(,%eax,8),%eax
80101daa:	85 c0                	test   %eax,%eax
80101dac:	75 0a                	jne    80101db8 <readi+0x4a>
      return -1;
80101dae:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101db3:	e9 1b 01 00 00       	jmp    80101ed3 <readi+0x165>
    return devsw[ip->major].read(ip, dst, n);
80101db8:	8b 45 08             	mov    0x8(%ebp),%eax
80101dbb:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101dbf:	98                   	cwtl   
80101dc0:	8b 14 c5 00 f8 10 80 	mov    -0x7fef0800(,%eax,8),%edx
80101dc7:	8b 45 14             	mov    0x14(%ebp),%eax
80101dca:	89 44 24 08          	mov    %eax,0x8(%esp)
80101dce:	8b 45 0c             	mov    0xc(%ebp),%eax
80101dd1:	89 44 24 04          	mov    %eax,0x4(%esp)
80101dd5:	8b 45 08             	mov    0x8(%ebp),%eax
80101dd8:	89 04 24             	mov    %eax,(%esp)
80101ddb:	ff d2                	call   *%edx
80101ddd:	e9 f1 00 00 00       	jmp    80101ed3 <readi+0x165>
  }

  if(off > ip->size || off + n < off)
80101de2:	8b 45 08             	mov    0x8(%ebp),%eax
80101de5:	8b 40 18             	mov    0x18(%eax),%eax
80101de8:	3b 45 10             	cmp    0x10(%ebp),%eax
80101deb:	72 0d                	jb     80101dfa <readi+0x8c>
80101ded:	8b 45 14             	mov    0x14(%ebp),%eax
80101df0:	8b 55 10             	mov    0x10(%ebp),%edx
80101df3:	01 d0                	add    %edx,%eax
80101df5:	3b 45 10             	cmp    0x10(%ebp),%eax
80101df8:	73 0a                	jae    80101e04 <readi+0x96>
    return -1;
80101dfa:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101dff:	e9 cf 00 00 00       	jmp    80101ed3 <readi+0x165>
  if(off + n > ip->size)
80101e04:	8b 45 14             	mov    0x14(%ebp),%eax
80101e07:	8b 55 10             	mov    0x10(%ebp),%edx
80101e0a:	01 c2                	add    %eax,%edx
80101e0c:	8b 45 08             	mov    0x8(%ebp),%eax
80101e0f:	8b 40 18             	mov    0x18(%eax),%eax
80101e12:	39 c2                	cmp    %eax,%edx
80101e14:	76 0c                	jbe    80101e22 <readi+0xb4>
    n = ip->size - off;
80101e16:	8b 45 08             	mov    0x8(%ebp),%eax
80101e19:	8b 40 18             	mov    0x18(%eax),%eax
80101e1c:	2b 45 10             	sub    0x10(%ebp),%eax
80101e1f:	89 45 14             	mov    %eax,0x14(%ebp)

  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101e22:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80101e29:	e9 96 00 00 00       	jmp    80101ec4 <readi+0x156>
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101e2e:	8b 45 10             	mov    0x10(%ebp),%eax
80101e31:	c1 e8 09             	shr    $0x9,%eax
80101e34:	89 44 24 04          	mov    %eax,0x4(%esp)
80101e38:	8b 45 08             	mov    0x8(%ebp),%eax
80101e3b:	89 04 24             	mov    %eax,(%esp)
80101e3e:	e8 d7 fc ff ff       	call   80101b1a <bmap>
80101e43:	8b 55 08             	mov    0x8(%ebp),%edx
80101e46:	8b 12                	mov    (%edx),%edx
80101e48:	89 44 24 04          	mov    %eax,0x4(%esp)
80101e4c:	89 14 24             	mov    %edx,(%esp)
80101e4f:	e8 52 e3 ff ff       	call   801001a6 <bread>
80101e54:	89 45 f0             	mov    %eax,-0x10(%ebp)
    m = min(n - tot, BSIZE - off%BSIZE);
80101e57:	8b 45 10             	mov    0x10(%ebp),%eax
80101e5a:	89 c2                	mov    %eax,%edx
80101e5c:	81 e2 ff 01 00 00    	and    $0x1ff,%edx
80101e62:	b8 00 02 00 00       	mov    $0x200,%eax
80101e67:	89 c1                	mov    %eax,%ecx
80101e69:	29 d1                	sub    %edx,%ecx
80101e6b:	89 ca                	mov    %ecx,%edx
80101e6d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101e70:	8b 4d 14             	mov    0x14(%ebp),%ecx
80101e73:	89 cb                	mov    %ecx,%ebx
80101e75:	29 c3                	sub    %eax,%ebx
80101e77:	89 d8                	mov    %ebx,%eax
80101e79:	39 c2                	cmp    %eax,%edx
80101e7b:	0f 46 c2             	cmovbe %edx,%eax
80101e7e:	89 45 ec             	mov    %eax,-0x14(%ebp)
    memmove(dst, bp->data + off%BSIZE, m);
80101e81:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101e84:	8d 50 18             	lea    0x18(%eax),%edx
80101e87:	8b 45 10             	mov    0x10(%ebp),%eax
80101e8a:	25 ff 01 00 00       	and    $0x1ff,%eax
80101e8f:	01 c2                	add    %eax,%edx
80101e91:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101e94:	89 44 24 08          	mov    %eax,0x8(%esp)
80101e98:	89 54 24 04          	mov    %edx,0x4(%esp)
80101e9c:	8b 45 0c             	mov    0xc(%ebp),%eax
80101e9f:	89 04 24             	mov    %eax,(%esp)
80101ea2:	e8 c6 30 00 00       	call   80104f6d <memmove>
    brelse(bp);
80101ea7:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101eaa:	89 04 24             	mov    %eax,(%esp)
80101ead:	e8 65 e3 ff ff       	call   80100217 <brelse>
  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > ip->size)
    n = ip->size - off;

  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101eb2:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101eb5:	01 45 f4             	add    %eax,-0xc(%ebp)
80101eb8:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101ebb:	01 45 10             	add    %eax,0x10(%ebp)
80101ebe:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101ec1:	01 45 0c             	add    %eax,0xc(%ebp)
80101ec4:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101ec7:	3b 45 14             	cmp    0x14(%ebp),%eax
80101eca:	0f 82 5e ff ff ff    	jb     80101e2e <readi+0xc0>
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
    m = min(n - tot, BSIZE - off%BSIZE);
    memmove(dst, bp->data + off%BSIZE, m);
    brelse(bp);
  }
  return n;
80101ed0:	8b 45 14             	mov    0x14(%ebp),%eax
}
80101ed3:	83 c4 24             	add    $0x24,%esp
80101ed6:	5b                   	pop    %ebx
80101ed7:	5d                   	pop    %ebp
80101ed8:	c3                   	ret    

80101ed9 <writei>:

// PAGEBREAK!
// Write data to inode.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101ed9:	55                   	push   %ebp
80101eda:	89 e5                	mov    %esp,%ebp
80101edc:	53                   	push   %ebx
80101edd:	83 ec 24             	sub    $0x24,%esp
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
80101ee0:	8b 45 08             	mov    0x8(%ebp),%eax
80101ee3:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80101ee7:	66 83 f8 03          	cmp    $0x3,%ax
80101eeb:	75 60                	jne    80101f4d <writei+0x74>
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
80101eed:	8b 45 08             	mov    0x8(%ebp),%eax
80101ef0:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101ef4:	66 85 c0             	test   %ax,%ax
80101ef7:	78 20                	js     80101f19 <writei+0x40>
80101ef9:	8b 45 08             	mov    0x8(%ebp),%eax
80101efc:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101f00:	66 83 f8 09          	cmp    $0x9,%ax
80101f04:	7f 13                	jg     80101f19 <writei+0x40>
80101f06:	8b 45 08             	mov    0x8(%ebp),%eax
80101f09:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101f0d:	98                   	cwtl   
80101f0e:	8b 04 c5 04 f8 10 80 	mov    -0x7fef07fc(,%eax,8),%eax
80101f15:	85 c0                	test   %eax,%eax
80101f17:	75 0a                	jne    80101f23 <writei+0x4a>
      return -1;
80101f19:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101f1e:	e9 46 01 00 00       	jmp    80102069 <writei+0x190>
    return devsw[ip->major].write(ip, src, n);
80101f23:	8b 45 08             	mov    0x8(%ebp),%eax
80101f26:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101f2a:	98                   	cwtl   
80101f2b:	8b 14 c5 04 f8 10 80 	mov    -0x7fef07fc(,%eax,8),%edx
80101f32:	8b 45 14             	mov    0x14(%ebp),%eax
80101f35:	89 44 24 08          	mov    %eax,0x8(%esp)
80101f39:	8b 45 0c             	mov    0xc(%ebp),%eax
80101f3c:	89 44 24 04          	mov    %eax,0x4(%esp)
80101f40:	8b 45 08             	mov    0x8(%ebp),%eax
80101f43:	89 04 24             	mov    %eax,(%esp)
80101f46:	ff d2                	call   *%edx
80101f48:	e9 1c 01 00 00       	jmp    80102069 <writei+0x190>
  }

  if(off > ip->size || off + n < off)
80101f4d:	8b 45 08             	mov    0x8(%ebp),%eax
80101f50:	8b 40 18             	mov    0x18(%eax),%eax
80101f53:	3b 45 10             	cmp    0x10(%ebp),%eax
80101f56:	72 0d                	jb     80101f65 <writei+0x8c>
80101f58:	8b 45 14             	mov    0x14(%ebp),%eax
80101f5b:	8b 55 10             	mov    0x10(%ebp),%edx
80101f5e:	01 d0                	add    %edx,%eax
80101f60:	3b 45 10             	cmp    0x10(%ebp),%eax
80101f63:	73 0a                	jae    80101f6f <writei+0x96>
    return -1;
80101f65:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101f6a:	e9 fa 00 00 00       	jmp    80102069 <writei+0x190>
  if(off + n > MAXFILE*BSIZE)
80101f6f:	8b 45 14             	mov    0x14(%ebp),%eax
80101f72:	8b 55 10             	mov    0x10(%ebp),%edx
80101f75:	01 d0                	add    %edx,%eax
80101f77:	3d 00 18 01 00       	cmp    $0x11800,%eax
80101f7c:	76 0a                	jbe    80101f88 <writei+0xaf>
    return -1;
80101f7e:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101f83:	e9 e1 00 00 00       	jmp    80102069 <writei+0x190>

  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101f88:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80101f8f:	e9 a1 00 00 00       	jmp    80102035 <writei+0x15c>
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101f94:	8b 45 10             	mov    0x10(%ebp),%eax
80101f97:	c1 e8 09             	shr    $0x9,%eax
80101f9a:	89 44 24 04          	mov    %eax,0x4(%esp)
80101f9e:	8b 45 08             	mov    0x8(%ebp),%eax
80101fa1:	89 04 24             	mov    %eax,(%esp)
80101fa4:	e8 71 fb ff ff       	call   80101b1a <bmap>
80101fa9:	8b 55 08             	mov    0x8(%ebp),%edx
80101fac:	8b 12                	mov    (%edx),%edx
80101fae:	89 44 24 04          	mov    %eax,0x4(%esp)
80101fb2:	89 14 24             	mov    %edx,(%esp)
80101fb5:	e8 ec e1 ff ff       	call   801001a6 <bread>
80101fba:	89 45 f0             	mov    %eax,-0x10(%ebp)
    m = min(n - tot, BSIZE - off%BSIZE);
80101fbd:	8b 45 10             	mov    0x10(%ebp),%eax
80101fc0:	89 c2                	mov    %eax,%edx
80101fc2:	81 e2 ff 01 00 00    	and    $0x1ff,%edx
80101fc8:	b8 00 02 00 00       	mov    $0x200,%eax
80101fcd:	89 c1                	mov    %eax,%ecx
80101fcf:	29 d1                	sub    %edx,%ecx
80101fd1:	89 ca                	mov    %ecx,%edx
80101fd3:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101fd6:	8b 4d 14             	mov    0x14(%ebp),%ecx
80101fd9:	89 cb                	mov    %ecx,%ebx
80101fdb:	29 c3                	sub    %eax,%ebx
80101fdd:	89 d8                	mov    %ebx,%eax
80101fdf:	39 c2                	cmp    %eax,%edx
80101fe1:	0f 46 c2             	cmovbe %edx,%eax
80101fe4:	89 45 ec             	mov    %eax,-0x14(%ebp)
    memmove(bp->data + off%BSIZE, src, m);
80101fe7:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101fea:	8d 50 18             	lea    0x18(%eax),%edx
80101fed:	8b 45 10             	mov    0x10(%ebp),%eax
80101ff0:	25 ff 01 00 00       	and    $0x1ff,%eax
80101ff5:	01 c2                	add    %eax,%edx
80101ff7:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101ffa:	89 44 24 08          	mov    %eax,0x8(%esp)
80101ffe:	8b 45 0c             	mov    0xc(%ebp),%eax
80102001:	89 44 24 04          	mov    %eax,0x4(%esp)
80102005:	89 14 24             	mov    %edx,(%esp)
80102008:	e8 60 2f 00 00       	call   80104f6d <memmove>
    log_write(bp);
8010200d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80102010:	89 04 24             	mov    %eax,(%esp)
80102013:	e8 ba 13 00 00       	call   801033d2 <log_write>
    brelse(bp);
80102018:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010201b:	89 04 24             	mov    %eax,(%esp)
8010201e:	e8 f4 e1 ff ff       	call   80100217 <brelse>
  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > MAXFILE*BSIZE)
    return -1;

  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80102023:	8b 45 ec             	mov    -0x14(%ebp),%eax
80102026:	01 45 f4             	add    %eax,-0xc(%ebp)
80102029:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010202c:	01 45 10             	add    %eax,0x10(%ebp)
8010202f:	8b 45 ec             	mov    -0x14(%ebp),%eax
80102032:	01 45 0c             	add    %eax,0xc(%ebp)
80102035:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102038:	3b 45 14             	cmp    0x14(%ebp),%eax
8010203b:	0f 82 53 ff ff ff    	jb     80101f94 <writei+0xbb>
    memmove(bp->data + off%BSIZE, src, m);
    log_write(bp);
    brelse(bp);
  }

  if(n > 0 && off > ip->size){
80102041:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
80102045:	74 1f                	je     80102066 <writei+0x18d>
80102047:	8b 45 08             	mov    0x8(%ebp),%eax
8010204a:	8b 40 18             	mov    0x18(%eax),%eax
8010204d:	3b 45 10             	cmp    0x10(%ebp),%eax
80102050:	73 14                	jae    80102066 <writei+0x18d>
    ip->size = off;
80102052:	8b 45 08             	mov    0x8(%ebp),%eax
80102055:	8b 55 10             	mov    0x10(%ebp),%edx
80102058:	89 50 18             	mov    %edx,0x18(%eax)
    iupdate(ip);
8010205b:	8b 45 08             	mov    0x8(%ebp),%eax
8010205e:	89 04 24             	mov    %eax,(%esp)
80102061:	e8 56 f6 ff ff       	call   801016bc <iupdate>
  }
  return n;
80102066:	8b 45 14             	mov    0x14(%ebp),%eax
}
80102069:	83 c4 24             	add    $0x24,%esp
8010206c:	5b                   	pop    %ebx
8010206d:	5d                   	pop    %ebp
8010206e:	c3                   	ret    

8010206f <namecmp>:
//PAGEBREAK!
// Directories

int
namecmp(const char *s, const char *t)
{
8010206f:	55                   	push   %ebp
80102070:	89 e5                	mov    %esp,%ebp
80102072:	83 ec 18             	sub    $0x18,%esp
  return strncmp(s, t, DIRSIZ);
80102075:	c7 44 24 08 0e 00 00 	movl   $0xe,0x8(%esp)
8010207c:	00 
8010207d:	8b 45 0c             	mov    0xc(%ebp),%eax
80102080:	89 44 24 04          	mov    %eax,0x4(%esp)
80102084:	8b 45 08             	mov    0x8(%ebp),%eax
80102087:	89 04 24             	mov    %eax,(%esp)
8010208a:	e8 82 2f 00 00       	call   80105011 <strncmp>
}
8010208f:	c9                   	leave  
80102090:	c3                   	ret    

80102091 <dirlookup>:

// Look for a directory entry in a directory.
// If found, set *poff to byte offset of entry.
struct inode*
dirlookup(struct inode *dp, char *name, uint *poff)
{
80102091:	55                   	push   %ebp
80102092:	89 e5                	mov    %esp,%ebp
80102094:	83 ec 38             	sub    $0x38,%esp
  uint off, inum;
  struct dirent de;

  if(dp->type != T_DIR)
80102097:	8b 45 08             	mov    0x8(%ebp),%eax
8010209a:	0f b7 40 10          	movzwl 0x10(%eax),%eax
8010209e:	66 83 f8 01          	cmp    $0x1,%ax
801020a2:	74 0c                	je     801020b0 <dirlookup+0x1f>
    panic("dirlookup not DIR");
801020a4:	c7 04 24 9d 89 10 80 	movl   $0x8010899d,(%esp)
801020ab:	e8 a5 e4 ff ff       	call   80100555 <panic>

  for(off = 0; off < dp->size; off += sizeof(de)){
801020b0:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801020b7:	e9 87 00 00 00       	jmp    80102143 <dirlookup+0xb2>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801020bc:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
801020c3:	00 
801020c4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801020c7:	89 44 24 08          	mov    %eax,0x8(%esp)
801020cb:	8d 45 e0             	lea    -0x20(%ebp),%eax
801020ce:	89 44 24 04          	mov    %eax,0x4(%esp)
801020d2:	8b 45 08             	mov    0x8(%ebp),%eax
801020d5:	89 04 24             	mov    %eax,(%esp)
801020d8:	e8 91 fc ff ff       	call   80101d6e <readi>
801020dd:	83 f8 10             	cmp    $0x10,%eax
801020e0:	74 0c                	je     801020ee <dirlookup+0x5d>
      panic("dirlink read");
801020e2:	c7 04 24 af 89 10 80 	movl   $0x801089af,(%esp)
801020e9:	e8 67 e4 ff ff       	call   80100555 <panic>
    if(de.inum == 0)
801020ee:	0f b7 45 e0          	movzwl -0x20(%ebp),%eax
801020f2:	66 85 c0             	test   %ax,%ax
801020f5:	74 47                	je     8010213e <dirlookup+0xad>
      continue;
    if(namecmp(name, de.name) == 0){
801020f7:	8d 45 e0             	lea    -0x20(%ebp),%eax
801020fa:	83 c0 02             	add    $0x2,%eax
801020fd:	89 44 24 04          	mov    %eax,0x4(%esp)
80102101:	8b 45 0c             	mov    0xc(%ebp),%eax
80102104:	89 04 24             	mov    %eax,(%esp)
80102107:	e8 63 ff ff ff       	call   8010206f <namecmp>
8010210c:	85 c0                	test   %eax,%eax
8010210e:	75 2f                	jne    8010213f <dirlookup+0xae>
      // entry matches path element
      if(poff)
80102110:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80102114:	74 08                	je     8010211e <dirlookup+0x8d>
        *poff = off;
80102116:	8b 45 10             	mov    0x10(%ebp),%eax
80102119:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010211c:	89 10                	mov    %edx,(%eax)
      inum = de.inum;
8010211e:	0f b7 45 e0          	movzwl -0x20(%ebp),%eax
80102122:	0f b7 c0             	movzwl %ax,%eax
80102125:	89 45 f0             	mov    %eax,-0x10(%ebp)
      return iget(dp->dev, inum);
80102128:	8b 45 08             	mov    0x8(%ebp),%eax
8010212b:	8b 00                	mov    (%eax),%eax
8010212d:	8b 55 f0             	mov    -0x10(%ebp),%edx
80102130:	89 54 24 04          	mov    %edx,0x4(%esp)
80102134:	89 04 24             	mov    %eax,(%esp)
80102137:	e8 38 f6 ff ff       	call   80101774 <iget>
8010213c:	eb 19                	jmp    80102157 <dirlookup+0xc6>

  for(off = 0; off < dp->size; off += sizeof(de)){
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
      panic("dirlink read");
    if(de.inum == 0)
      continue;
8010213e:	90                   	nop
  struct dirent de;

  if(dp->type != T_DIR)
    panic("dirlookup not DIR");

  for(off = 0; off < dp->size; off += sizeof(de)){
8010213f:	83 45 f4 10          	addl   $0x10,-0xc(%ebp)
80102143:	8b 45 08             	mov    0x8(%ebp),%eax
80102146:	8b 40 18             	mov    0x18(%eax),%eax
80102149:	3b 45 f4             	cmp    -0xc(%ebp),%eax
8010214c:	0f 87 6a ff ff ff    	ja     801020bc <dirlookup+0x2b>
      inum = de.inum;
      return iget(dp->dev, inum);
    }
  }

  return 0;
80102152:	b8 00 00 00 00       	mov    $0x0,%eax
}
80102157:	c9                   	leave  
80102158:	c3                   	ret    

80102159 <dirlink>:

// Write a new directory entry (name, inum) into the directory dp.
int
dirlink(struct inode *dp, char *name, uint inum)
{
80102159:	55                   	push   %ebp
8010215a:	89 e5                	mov    %esp,%ebp
8010215c:	83 ec 38             	sub    $0x38,%esp
  int off;
  struct dirent de;
  struct inode *ip;

  // Check that name is not present.
  if((ip = dirlookup(dp, name, 0)) != 0){
8010215f:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80102166:	00 
80102167:	8b 45 0c             	mov    0xc(%ebp),%eax
8010216a:	89 44 24 04          	mov    %eax,0x4(%esp)
8010216e:	8b 45 08             	mov    0x8(%ebp),%eax
80102171:	89 04 24             	mov    %eax,(%esp)
80102174:	e8 18 ff ff ff       	call   80102091 <dirlookup>
80102179:	89 45 f0             	mov    %eax,-0x10(%ebp)
8010217c:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80102180:	74 15                	je     80102197 <dirlink+0x3e>
    iput(ip);
80102182:	8b 45 f0             	mov    -0x10(%ebp),%eax
80102185:	89 04 24             	mov    %eax,(%esp)
80102188:	e8 9e f8 ff ff       	call   80101a2b <iput>
    return -1;
8010218d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80102192:	e9 b8 00 00 00       	jmp    8010224f <dirlink+0xf6>
  }

  // Look for an empty dirent.
  for(off = 0; off < dp->size; off += sizeof(de)){
80102197:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010219e:	eb 44                	jmp    801021e4 <dirlink+0x8b>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801021a0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801021a3:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
801021aa:	00 
801021ab:	89 44 24 08          	mov    %eax,0x8(%esp)
801021af:	8d 45 e0             	lea    -0x20(%ebp),%eax
801021b2:	89 44 24 04          	mov    %eax,0x4(%esp)
801021b6:	8b 45 08             	mov    0x8(%ebp),%eax
801021b9:	89 04 24             	mov    %eax,(%esp)
801021bc:	e8 ad fb ff ff       	call   80101d6e <readi>
801021c1:	83 f8 10             	cmp    $0x10,%eax
801021c4:	74 0c                	je     801021d2 <dirlink+0x79>
      panic("dirlink read");
801021c6:	c7 04 24 af 89 10 80 	movl   $0x801089af,(%esp)
801021cd:	e8 83 e3 ff ff       	call   80100555 <panic>
    if(de.inum == 0)
801021d2:	0f b7 45 e0          	movzwl -0x20(%ebp),%eax
801021d6:	66 85 c0             	test   %ax,%ax
801021d9:	74 18                	je     801021f3 <dirlink+0x9a>
    iput(ip);
    return -1;
  }

  // Look for an empty dirent.
  for(off = 0; off < dp->size; off += sizeof(de)){
801021db:	8b 45 f4             	mov    -0xc(%ebp),%eax
801021de:	83 c0 10             	add    $0x10,%eax
801021e1:	89 45 f4             	mov    %eax,-0xc(%ebp)
801021e4:	8b 55 f4             	mov    -0xc(%ebp),%edx
801021e7:	8b 45 08             	mov    0x8(%ebp),%eax
801021ea:	8b 40 18             	mov    0x18(%eax),%eax
801021ed:	39 c2                	cmp    %eax,%edx
801021ef:	72 af                	jb     801021a0 <dirlink+0x47>
801021f1:	eb 01                	jmp    801021f4 <dirlink+0x9b>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
      panic("dirlink read");
    if(de.inum == 0)
      break;
801021f3:	90                   	nop
  }

  strncpy(de.name, name, DIRSIZ);
801021f4:	c7 44 24 08 0e 00 00 	movl   $0xe,0x8(%esp)
801021fb:	00 
801021fc:	8b 45 0c             	mov    0xc(%ebp),%eax
801021ff:	89 44 24 04          	mov    %eax,0x4(%esp)
80102203:	8d 45 e0             	lea    -0x20(%ebp),%eax
80102206:	83 c0 02             	add    $0x2,%eax
80102209:	89 04 24             	mov    %eax,(%esp)
8010220c:	e8 58 2e 00 00       	call   80105069 <strncpy>
  de.inum = inum;
80102211:	8b 45 10             	mov    0x10(%ebp),%eax
80102214:	66 89 45 e0          	mov    %ax,-0x20(%ebp)
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80102218:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010221b:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
80102222:	00 
80102223:	89 44 24 08          	mov    %eax,0x8(%esp)
80102227:	8d 45 e0             	lea    -0x20(%ebp),%eax
8010222a:	89 44 24 04          	mov    %eax,0x4(%esp)
8010222e:	8b 45 08             	mov    0x8(%ebp),%eax
80102231:	89 04 24             	mov    %eax,(%esp)
80102234:	e8 a0 fc ff ff       	call   80101ed9 <writei>
80102239:	83 f8 10             	cmp    $0x10,%eax
8010223c:	74 0c                	je     8010224a <dirlink+0xf1>
    panic("dirlink");
8010223e:	c7 04 24 bc 89 10 80 	movl   $0x801089bc,(%esp)
80102245:	e8 0b e3 ff ff       	call   80100555 <panic>
  
  return 0;
8010224a:	b8 00 00 00 00       	mov    $0x0,%eax
}
8010224f:	c9                   	leave  
80102250:	c3                   	ret    

80102251 <skipelem>:
//   skipelem("a", name) = "", setting name = "a"
//   skipelem("", name) = skipelem("////", name) = 0
//
static char*
skipelem(char *path, char *name)
{
80102251:	55                   	push   %ebp
80102252:	89 e5                	mov    %esp,%ebp
80102254:	83 ec 28             	sub    $0x28,%esp
  char *s;
  int len;

  while(*path == '/')
80102257:	eb 04                	jmp    8010225d <skipelem+0xc>
    path++;
80102259:	83 45 08 01          	addl   $0x1,0x8(%ebp)
skipelem(char *path, char *name)
{
  char *s;
  int len;

  while(*path == '/')
8010225d:	8b 45 08             	mov    0x8(%ebp),%eax
80102260:	0f b6 00             	movzbl (%eax),%eax
80102263:	3c 2f                	cmp    $0x2f,%al
80102265:	74 f2                	je     80102259 <skipelem+0x8>
    path++;
  if(*path == 0)
80102267:	8b 45 08             	mov    0x8(%ebp),%eax
8010226a:	0f b6 00             	movzbl (%eax),%eax
8010226d:	84 c0                	test   %al,%al
8010226f:	75 0a                	jne    8010227b <skipelem+0x2a>
    return 0;
80102271:	b8 00 00 00 00       	mov    $0x0,%eax
80102276:	e9 86 00 00 00       	jmp    80102301 <skipelem+0xb0>
  s = path;
8010227b:	8b 45 08             	mov    0x8(%ebp),%eax
8010227e:	89 45 f4             	mov    %eax,-0xc(%ebp)
  while(*path != '/' && *path != 0)
80102281:	eb 04                	jmp    80102287 <skipelem+0x36>
    path++;
80102283:	83 45 08 01          	addl   $0x1,0x8(%ebp)
  while(*path == '/')
    path++;
  if(*path == 0)
    return 0;
  s = path;
  while(*path != '/' && *path != 0)
80102287:	8b 45 08             	mov    0x8(%ebp),%eax
8010228a:	0f b6 00             	movzbl (%eax),%eax
8010228d:	3c 2f                	cmp    $0x2f,%al
8010228f:	74 0a                	je     8010229b <skipelem+0x4a>
80102291:	8b 45 08             	mov    0x8(%ebp),%eax
80102294:	0f b6 00             	movzbl (%eax),%eax
80102297:	84 c0                	test   %al,%al
80102299:	75 e8                	jne    80102283 <skipelem+0x32>
    path++;
  len = path - s;
8010229b:	8b 55 08             	mov    0x8(%ebp),%edx
8010229e:	8b 45 f4             	mov    -0xc(%ebp),%eax
801022a1:	89 d1                	mov    %edx,%ecx
801022a3:	29 c1                	sub    %eax,%ecx
801022a5:	89 c8                	mov    %ecx,%eax
801022a7:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(len >= DIRSIZ)
801022aa:	83 7d f0 0d          	cmpl   $0xd,-0x10(%ebp)
801022ae:	7e 1c                	jle    801022cc <skipelem+0x7b>
    memmove(name, s, DIRSIZ);
801022b0:	c7 44 24 08 0e 00 00 	movl   $0xe,0x8(%esp)
801022b7:	00 
801022b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801022bb:	89 44 24 04          	mov    %eax,0x4(%esp)
801022bf:	8b 45 0c             	mov    0xc(%ebp),%eax
801022c2:	89 04 24             	mov    %eax,(%esp)
801022c5:	e8 a3 2c 00 00       	call   80104f6d <memmove>
  else {
    memmove(name, s, len);
    name[len] = 0;
  }
  while(*path == '/')
801022ca:	eb 28                	jmp    801022f4 <skipelem+0xa3>
    path++;
  len = path - s;
  if(len >= DIRSIZ)
    memmove(name, s, DIRSIZ);
  else {
    memmove(name, s, len);
801022cc:	8b 45 f0             	mov    -0x10(%ebp),%eax
801022cf:	89 44 24 08          	mov    %eax,0x8(%esp)
801022d3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801022d6:	89 44 24 04          	mov    %eax,0x4(%esp)
801022da:	8b 45 0c             	mov    0xc(%ebp),%eax
801022dd:	89 04 24             	mov    %eax,(%esp)
801022e0:	e8 88 2c 00 00       	call   80104f6d <memmove>
    name[len] = 0;
801022e5:	8b 45 f0             	mov    -0x10(%ebp),%eax
801022e8:	03 45 0c             	add    0xc(%ebp),%eax
801022eb:	c6 00 00             	movb   $0x0,(%eax)
  }
  while(*path == '/')
801022ee:	eb 04                	jmp    801022f4 <skipelem+0xa3>
    path++;
801022f0:	83 45 08 01          	addl   $0x1,0x8(%ebp)
    memmove(name, s, DIRSIZ);
  else {
    memmove(name, s, len);
    name[len] = 0;
  }
  while(*path == '/')
801022f4:	8b 45 08             	mov    0x8(%ebp),%eax
801022f7:	0f b6 00             	movzbl (%eax),%eax
801022fa:	3c 2f                	cmp    $0x2f,%al
801022fc:	74 f2                	je     801022f0 <skipelem+0x9f>
    path++;
  return path;
801022fe:	8b 45 08             	mov    0x8(%ebp),%eax
}
80102301:	c9                   	leave  
80102302:	c3                   	ret    

80102303 <namex>:
// Look up and return the inode for a path name.
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
static struct inode*
namex(char *path, int nameiparent, char *name)
{
80102303:	55                   	push   %ebp
80102304:	89 e5                	mov    %esp,%ebp
80102306:	83 ec 28             	sub    $0x28,%esp
  struct inode *ip, *next;

  if(*path == '/')
80102309:	8b 45 08             	mov    0x8(%ebp),%eax
8010230c:	0f b6 00             	movzbl (%eax),%eax
8010230f:	3c 2f                	cmp    $0x2f,%al
80102311:	75 1c                	jne    8010232f <namex+0x2c>
    ip = iget(ROOTDEV, ROOTINO);
80102313:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
8010231a:	00 
8010231b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80102322:	e8 4d f4 ff ff       	call   80101774 <iget>
80102327:	89 45 f4             	mov    %eax,-0xc(%ebp)
  else
    ip = idup(proc->cwd);

  while((path = skipelem(path, name)) != 0){
8010232a:	e9 af 00 00 00       	jmp    801023de <namex+0xdb>
  struct inode *ip, *next;

  if(*path == '/')
    ip = iget(ROOTDEV, ROOTINO);
  else
    ip = idup(proc->cwd);
8010232f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80102335:	8b 40 68             	mov    0x68(%eax),%eax
80102338:	89 04 24             	mov    %eax,(%esp)
8010233b:	e8 06 f5 ff ff       	call   80101846 <idup>
80102340:	89 45 f4             	mov    %eax,-0xc(%ebp)

  while((path = skipelem(path, name)) != 0){
80102343:	e9 96 00 00 00       	jmp    801023de <namex+0xdb>
    ilock(ip);
80102348:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010234b:	89 04 24             	mov    %eax,(%esp)
8010234e:	e8 25 f5 ff ff       	call   80101878 <ilock>
    if(ip->type != T_DIR){
80102353:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102356:	0f b7 40 10          	movzwl 0x10(%eax),%eax
8010235a:	66 83 f8 01          	cmp    $0x1,%ax
8010235e:	74 15                	je     80102375 <namex+0x72>
      iunlockput(ip);
80102360:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102363:	89 04 24             	mov    %eax,(%esp)
80102366:	e8 91 f7 ff ff       	call   80101afc <iunlockput>
      return 0;
8010236b:	b8 00 00 00 00       	mov    $0x0,%eax
80102370:	e9 a3 00 00 00       	jmp    80102418 <namex+0x115>
    }
    if(nameiparent && *path == '\0'){
80102375:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
80102379:	74 1d                	je     80102398 <namex+0x95>
8010237b:	8b 45 08             	mov    0x8(%ebp),%eax
8010237e:	0f b6 00             	movzbl (%eax),%eax
80102381:	84 c0                	test   %al,%al
80102383:	75 13                	jne    80102398 <namex+0x95>
      // Stop one level early.
      iunlock(ip);
80102385:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102388:	89 04 24             	mov    %eax,(%esp)
8010238b:	e8 36 f6 ff ff       	call   801019c6 <iunlock>
      return ip;
80102390:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102393:	e9 80 00 00 00       	jmp    80102418 <namex+0x115>
    }
    if((next = dirlookup(ip, name, 0)) == 0){
80102398:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
8010239f:	00 
801023a0:	8b 45 10             	mov    0x10(%ebp),%eax
801023a3:	89 44 24 04          	mov    %eax,0x4(%esp)
801023a7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801023aa:	89 04 24             	mov    %eax,(%esp)
801023ad:	e8 df fc ff ff       	call   80102091 <dirlookup>
801023b2:	89 45 f0             	mov    %eax,-0x10(%ebp)
801023b5:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801023b9:	75 12                	jne    801023cd <namex+0xca>
      iunlockput(ip);
801023bb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801023be:	89 04 24             	mov    %eax,(%esp)
801023c1:	e8 36 f7 ff ff       	call   80101afc <iunlockput>
      return 0;
801023c6:	b8 00 00 00 00       	mov    $0x0,%eax
801023cb:	eb 4b                	jmp    80102418 <namex+0x115>
    }
    iunlockput(ip);
801023cd:	8b 45 f4             	mov    -0xc(%ebp),%eax
801023d0:	89 04 24             	mov    %eax,(%esp)
801023d3:	e8 24 f7 ff ff       	call   80101afc <iunlockput>
    ip = next;
801023d8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801023db:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(*path == '/')
    ip = iget(ROOTDEV, ROOTINO);
  else
    ip = idup(proc->cwd);

  while((path = skipelem(path, name)) != 0){
801023de:	8b 45 10             	mov    0x10(%ebp),%eax
801023e1:	89 44 24 04          	mov    %eax,0x4(%esp)
801023e5:	8b 45 08             	mov    0x8(%ebp),%eax
801023e8:	89 04 24             	mov    %eax,(%esp)
801023eb:	e8 61 fe ff ff       	call   80102251 <skipelem>
801023f0:	89 45 08             	mov    %eax,0x8(%ebp)
801023f3:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
801023f7:	0f 85 4b ff ff ff    	jne    80102348 <namex+0x45>
      return 0;
    }
    iunlockput(ip);
    ip = next;
  }
  if(nameiparent){
801023fd:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
80102401:	74 12                	je     80102415 <namex+0x112>
    iput(ip);
80102403:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102406:	89 04 24             	mov    %eax,(%esp)
80102409:	e8 1d f6 ff ff       	call   80101a2b <iput>
    return 0;
8010240e:	b8 00 00 00 00       	mov    $0x0,%eax
80102413:	eb 03                	jmp    80102418 <namex+0x115>
  }
  return ip;
80102415:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80102418:	c9                   	leave  
80102419:	c3                   	ret    

8010241a <namei>:

struct inode*
namei(char *path)
{
8010241a:	55                   	push   %ebp
8010241b:	89 e5                	mov    %esp,%ebp
8010241d:	83 ec 28             	sub    $0x28,%esp
  char name[DIRSIZ];
  return namex(path, 0, name);
80102420:	8d 45 ea             	lea    -0x16(%ebp),%eax
80102423:	89 44 24 08          	mov    %eax,0x8(%esp)
80102427:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
8010242e:	00 
8010242f:	8b 45 08             	mov    0x8(%ebp),%eax
80102432:	89 04 24             	mov    %eax,(%esp)
80102435:	e8 c9 fe ff ff       	call   80102303 <namex>
}
8010243a:	c9                   	leave  
8010243b:	c3                   	ret    

8010243c <nameiparent>:

struct inode*
nameiparent(char *path, char *name)
{
8010243c:	55                   	push   %ebp
8010243d:	89 e5                	mov    %esp,%ebp
8010243f:	83 ec 18             	sub    $0x18,%esp
  return namex(path, 1, name);
80102442:	8b 45 0c             	mov    0xc(%ebp),%eax
80102445:	89 44 24 08          	mov    %eax,0x8(%esp)
80102449:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80102450:	00 
80102451:	8b 45 08             	mov    0x8(%ebp),%eax
80102454:	89 04 24             	mov    %eax,(%esp)
80102457:	e8 a7 fe ff ff       	call   80102303 <namex>
}
8010245c:	c9                   	leave  
8010245d:	c3                   	ret    
	...

80102460 <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
80102460:	55                   	push   %ebp
80102461:	89 e5                	mov    %esp,%ebp
80102463:	53                   	push   %ebx
80102464:	83 ec 14             	sub    $0x14,%esp
80102467:	8b 45 08             	mov    0x8(%ebp),%eax
8010246a:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010246e:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
80102472:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
80102476:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
8010247a:	ec                   	in     (%dx),%al
8010247b:	89 c3                	mov    %eax,%ebx
8010247d:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
80102480:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
80102484:	83 c4 14             	add    $0x14,%esp
80102487:	5b                   	pop    %ebx
80102488:	5d                   	pop    %ebp
80102489:	c3                   	ret    

8010248a <insl>:

static inline void
insl(int port, void *addr, int cnt)
{
8010248a:	55                   	push   %ebp
8010248b:	89 e5                	mov    %esp,%ebp
8010248d:	57                   	push   %edi
8010248e:	53                   	push   %ebx
  asm volatile("cld; rep insl" :
8010248f:	8b 55 08             	mov    0x8(%ebp),%edx
80102492:	8b 4d 0c             	mov    0xc(%ebp),%ecx
80102495:	8b 45 10             	mov    0x10(%ebp),%eax
80102498:	89 cb                	mov    %ecx,%ebx
8010249a:	89 df                	mov    %ebx,%edi
8010249c:	89 c1                	mov    %eax,%ecx
8010249e:	fc                   	cld    
8010249f:	f3 6d                	rep insl (%dx),%es:(%edi)
801024a1:	89 c8                	mov    %ecx,%eax
801024a3:	89 fb                	mov    %edi,%ebx
801024a5:	89 5d 0c             	mov    %ebx,0xc(%ebp)
801024a8:	89 45 10             	mov    %eax,0x10(%ebp)
               "=D" (addr), "=c" (cnt) :
               "d" (port), "0" (addr), "1" (cnt) :
               "memory", "cc");
}
801024ab:	5b                   	pop    %ebx
801024ac:	5f                   	pop    %edi
801024ad:	5d                   	pop    %ebp
801024ae:	c3                   	ret    

801024af <outb>:

static inline void
outb(ushort port, uchar data)
{
801024af:	55                   	push   %ebp
801024b0:	89 e5                	mov    %esp,%ebp
801024b2:	83 ec 08             	sub    $0x8,%esp
801024b5:	8b 55 08             	mov    0x8(%ebp),%edx
801024b8:	8b 45 0c             	mov    0xc(%ebp),%eax
801024bb:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
801024bf:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
801024c2:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
801024c6:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
801024ca:	ee                   	out    %al,(%dx)
}
801024cb:	c9                   	leave  
801024cc:	c3                   	ret    

801024cd <outsl>:
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
}

static inline void
outsl(int port, const void *addr, int cnt)
{
801024cd:	55                   	push   %ebp
801024ce:	89 e5                	mov    %esp,%ebp
801024d0:	56                   	push   %esi
801024d1:	53                   	push   %ebx
  asm volatile("cld; rep outsl" :
801024d2:	8b 55 08             	mov    0x8(%ebp),%edx
801024d5:	8b 4d 0c             	mov    0xc(%ebp),%ecx
801024d8:	8b 45 10             	mov    0x10(%ebp),%eax
801024db:	89 cb                	mov    %ecx,%ebx
801024dd:	89 de                	mov    %ebx,%esi
801024df:	89 c1                	mov    %eax,%ecx
801024e1:	fc                   	cld    
801024e2:	f3 6f                	rep outsl %ds:(%esi),(%dx)
801024e4:	89 c8                	mov    %ecx,%eax
801024e6:	89 f3                	mov    %esi,%ebx
801024e8:	89 5d 0c             	mov    %ebx,0xc(%ebp)
801024eb:	89 45 10             	mov    %eax,0x10(%ebp)
               "=S" (addr), "=c" (cnt) :
               "d" (port), "0" (addr), "1" (cnt) :
               "cc");
}
801024ee:	5b                   	pop    %ebx
801024ef:	5e                   	pop    %esi
801024f0:	5d                   	pop    %ebp
801024f1:	c3                   	ret    

801024f2 <idewait>:
static void idestart(struct buf*);

// Wait for IDE disk to become ready.
static int
idewait(int checkerr)
{
801024f2:	55                   	push   %ebp
801024f3:	89 e5                	mov    %esp,%ebp
801024f5:	83 ec 14             	sub    $0x14,%esp
  int r;

  while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 
801024f8:	90                   	nop
801024f9:	c7 04 24 f7 01 00 00 	movl   $0x1f7,(%esp)
80102500:	e8 5b ff ff ff       	call   80102460 <inb>
80102505:	0f b6 c0             	movzbl %al,%eax
80102508:	89 45 fc             	mov    %eax,-0x4(%ebp)
8010250b:	8b 45 fc             	mov    -0x4(%ebp),%eax
8010250e:	25 c0 00 00 00       	and    $0xc0,%eax
80102513:	83 f8 40             	cmp    $0x40,%eax
80102516:	75 e1                	jne    801024f9 <idewait+0x7>
    ;
  if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
80102518:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010251c:	74 11                	je     8010252f <idewait+0x3d>
8010251e:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102521:	83 e0 21             	and    $0x21,%eax
80102524:	85 c0                	test   %eax,%eax
80102526:	74 07                	je     8010252f <idewait+0x3d>
    return -1;
80102528:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010252d:	eb 05                	jmp    80102534 <idewait+0x42>
  return 0;
8010252f:	b8 00 00 00 00       	mov    $0x0,%eax
}
80102534:	c9                   	leave  
80102535:	c3                   	ret    

80102536 <ideinit>:

void
ideinit(void)
{
80102536:	55                   	push   %ebp
80102537:	89 e5                	mov    %esp,%ebp
80102539:	83 ec 28             	sub    $0x28,%esp
  int i;

  initlock(&idelock, "ide");
8010253c:	c7 44 24 04 c4 89 10 	movl   $0x801089c4,0x4(%esp)
80102543:	80 
80102544:	c7 04 24 00 c6 10 80 	movl   $0x8010c600,(%esp)
8010254b:	e8 da 26 00 00       	call   80104c2a <initlock>
  picenable(IRQ_IDE);
80102550:	c7 04 24 0e 00 00 00 	movl   $0xe,(%esp)
80102557:	e8 a5 16 00 00       	call   80103c01 <picenable>
  ioapicenable(IRQ_IDE, ncpu - 1);
8010255c:	a1 20 0f 11 80       	mov    0x80110f20,%eax
80102561:	83 e8 01             	sub    $0x1,%eax
80102564:	89 44 24 04          	mov    %eax,0x4(%esp)
80102568:	c7 04 24 0e 00 00 00 	movl   $0xe,(%esp)
8010256f:	e8 12 04 00 00       	call   80102986 <ioapicenable>
  idewait(0);
80102574:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
8010257b:	e8 72 ff ff ff       	call   801024f2 <idewait>
  
  // Check if disk 1 is present
  outb(0x1f6, 0xe0 | (1<<4));
80102580:	c7 44 24 04 f0 00 00 	movl   $0xf0,0x4(%esp)
80102587:	00 
80102588:	c7 04 24 f6 01 00 00 	movl   $0x1f6,(%esp)
8010258f:	e8 1b ff ff ff       	call   801024af <outb>
  for(i=0; i<1000; i++){
80102594:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010259b:	eb 20                	jmp    801025bd <ideinit+0x87>
    if(inb(0x1f7) != 0){
8010259d:	c7 04 24 f7 01 00 00 	movl   $0x1f7,(%esp)
801025a4:	e8 b7 fe ff ff       	call   80102460 <inb>
801025a9:	84 c0                	test   %al,%al
801025ab:	74 0c                	je     801025b9 <ideinit+0x83>
      havedisk1 = 1;
801025ad:	c7 05 38 c6 10 80 01 	movl   $0x1,0x8010c638
801025b4:	00 00 00 
      break;
801025b7:	eb 0d                	jmp    801025c6 <ideinit+0x90>
  ioapicenable(IRQ_IDE, ncpu - 1);
  idewait(0);
  
  // Check if disk 1 is present
  outb(0x1f6, 0xe0 | (1<<4));
  for(i=0; i<1000; i++){
801025b9:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801025bd:	81 7d f4 e7 03 00 00 	cmpl   $0x3e7,-0xc(%ebp)
801025c4:	7e d7                	jle    8010259d <ideinit+0x67>
      break;
    }
  }
  
  // Switch back to disk 0.
  outb(0x1f6, 0xe0 | (0<<4));
801025c6:	c7 44 24 04 e0 00 00 	movl   $0xe0,0x4(%esp)
801025cd:	00 
801025ce:	c7 04 24 f6 01 00 00 	movl   $0x1f6,(%esp)
801025d5:	e8 d5 fe ff ff       	call   801024af <outb>
}
801025da:	c9                   	leave  
801025db:	c3                   	ret    

801025dc <idestart>:

// Start the request for b.  Caller must hold idelock.
static void
idestart(struct buf *b)
{
801025dc:	55                   	push   %ebp
801025dd:	89 e5                	mov    %esp,%ebp
801025df:	83 ec 18             	sub    $0x18,%esp
  if(b == 0)
801025e2:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
801025e6:	75 0c                	jne    801025f4 <idestart+0x18>
    panic("idestart");
801025e8:	c7 04 24 c8 89 10 80 	movl   $0x801089c8,(%esp)
801025ef:	e8 61 df ff ff       	call   80100555 <panic>

  idewait(0);
801025f4:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
801025fb:	e8 f2 fe ff ff       	call   801024f2 <idewait>
  outb(0x3f6, 0);  // generate interrupt
80102600:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102607:	00 
80102608:	c7 04 24 f6 03 00 00 	movl   $0x3f6,(%esp)
8010260f:	e8 9b fe ff ff       	call   801024af <outb>
  outb(0x1f2, 1);  // number of sectors
80102614:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
8010261b:	00 
8010261c:	c7 04 24 f2 01 00 00 	movl   $0x1f2,(%esp)
80102623:	e8 87 fe ff ff       	call   801024af <outb>
  outb(0x1f3, b->sector & 0xff);
80102628:	8b 45 08             	mov    0x8(%ebp),%eax
8010262b:	8b 40 08             	mov    0x8(%eax),%eax
8010262e:	0f b6 c0             	movzbl %al,%eax
80102631:	89 44 24 04          	mov    %eax,0x4(%esp)
80102635:	c7 04 24 f3 01 00 00 	movl   $0x1f3,(%esp)
8010263c:	e8 6e fe ff ff       	call   801024af <outb>
  outb(0x1f4, (b->sector >> 8) & 0xff);
80102641:	8b 45 08             	mov    0x8(%ebp),%eax
80102644:	8b 40 08             	mov    0x8(%eax),%eax
80102647:	c1 e8 08             	shr    $0x8,%eax
8010264a:	0f b6 c0             	movzbl %al,%eax
8010264d:	89 44 24 04          	mov    %eax,0x4(%esp)
80102651:	c7 04 24 f4 01 00 00 	movl   $0x1f4,(%esp)
80102658:	e8 52 fe ff ff       	call   801024af <outb>
  outb(0x1f5, (b->sector >> 16) & 0xff);
8010265d:	8b 45 08             	mov    0x8(%ebp),%eax
80102660:	8b 40 08             	mov    0x8(%eax),%eax
80102663:	c1 e8 10             	shr    $0x10,%eax
80102666:	0f b6 c0             	movzbl %al,%eax
80102669:	89 44 24 04          	mov    %eax,0x4(%esp)
8010266d:	c7 04 24 f5 01 00 00 	movl   $0x1f5,(%esp)
80102674:	e8 36 fe ff ff       	call   801024af <outb>
  outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((b->sector>>24)&0x0f));
80102679:	8b 45 08             	mov    0x8(%ebp),%eax
8010267c:	8b 40 04             	mov    0x4(%eax),%eax
8010267f:	83 e0 01             	and    $0x1,%eax
80102682:	89 c2                	mov    %eax,%edx
80102684:	c1 e2 04             	shl    $0x4,%edx
80102687:	8b 45 08             	mov    0x8(%ebp),%eax
8010268a:	8b 40 08             	mov    0x8(%eax),%eax
8010268d:	c1 e8 18             	shr    $0x18,%eax
80102690:	83 e0 0f             	and    $0xf,%eax
80102693:	09 d0                	or     %edx,%eax
80102695:	83 c8 e0             	or     $0xffffffe0,%eax
80102698:	0f b6 c0             	movzbl %al,%eax
8010269b:	89 44 24 04          	mov    %eax,0x4(%esp)
8010269f:	c7 04 24 f6 01 00 00 	movl   $0x1f6,(%esp)
801026a6:	e8 04 fe ff ff       	call   801024af <outb>
  if(b->flags & B_DIRTY){
801026ab:	8b 45 08             	mov    0x8(%ebp),%eax
801026ae:	8b 00                	mov    (%eax),%eax
801026b0:	83 e0 04             	and    $0x4,%eax
801026b3:	85 c0                	test   %eax,%eax
801026b5:	74 34                	je     801026eb <idestart+0x10f>
    outb(0x1f7, IDE_CMD_WRITE);
801026b7:	c7 44 24 04 30 00 00 	movl   $0x30,0x4(%esp)
801026be:	00 
801026bf:	c7 04 24 f7 01 00 00 	movl   $0x1f7,(%esp)
801026c6:	e8 e4 fd ff ff       	call   801024af <outb>
    outsl(0x1f0, b->data, 512/4);
801026cb:	8b 45 08             	mov    0x8(%ebp),%eax
801026ce:	83 c0 18             	add    $0x18,%eax
801026d1:	c7 44 24 08 80 00 00 	movl   $0x80,0x8(%esp)
801026d8:	00 
801026d9:	89 44 24 04          	mov    %eax,0x4(%esp)
801026dd:	c7 04 24 f0 01 00 00 	movl   $0x1f0,(%esp)
801026e4:	e8 e4 fd ff ff       	call   801024cd <outsl>
801026e9:	eb 14                	jmp    801026ff <idestart+0x123>
  } else {
    outb(0x1f7, IDE_CMD_READ);
801026eb:	c7 44 24 04 20 00 00 	movl   $0x20,0x4(%esp)
801026f2:	00 
801026f3:	c7 04 24 f7 01 00 00 	movl   $0x1f7,(%esp)
801026fa:	e8 b0 fd ff ff       	call   801024af <outb>
  }
}
801026ff:	c9                   	leave  
80102700:	c3                   	ret    

80102701 <ideintr>:

// Interrupt handler.
void
ideintr(void)
{
80102701:	55                   	push   %ebp
80102702:	89 e5                	mov    %esp,%ebp
80102704:	83 ec 28             	sub    $0x28,%esp
  struct buf *b;

  // First queued buffer is the active request.
  acquire(&idelock);
80102707:	c7 04 24 00 c6 10 80 	movl   $0x8010c600,(%esp)
8010270e:	e8 38 25 00 00       	call   80104c4b <acquire>
  if((b = idequeue) == 0){
80102713:	a1 34 c6 10 80       	mov    0x8010c634,%eax
80102718:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010271b:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010271f:	75 11                	jne    80102732 <ideintr+0x31>
    release(&idelock);
80102721:	c7 04 24 00 c6 10 80 	movl   $0x8010c600,(%esp)
80102728:	e8 80 25 00 00       	call   80104cad <release>
    // cprintf("spurious IDE interrupt\n");
    return;
8010272d:	e9 90 00 00 00       	jmp    801027c2 <ideintr+0xc1>
  }
  idequeue = b->qnext;
80102732:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102735:	8b 40 14             	mov    0x14(%eax),%eax
80102738:	a3 34 c6 10 80       	mov    %eax,0x8010c634

  // Read data if needed.
  if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
8010273d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102740:	8b 00                	mov    (%eax),%eax
80102742:	83 e0 04             	and    $0x4,%eax
80102745:	85 c0                	test   %eax,%eax
80102747:	75 2e                	jne    80102777 <ideintr+0x76>
80102749:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80102750:	e8 9d fd ff ff       	call   801024f2 <idewait>
80102755:	85 c0                	test   %eax,%eax
80102757:	78 1e                	js     80102777 <ideintr+0x76>
    insl(0x1f0, b->data, 512/4);
80102759:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010275c:	83 c0 18             	add    $0x18,%eax
8010275f:	c7 44 24 08 80 00 00 	movl   $0x80,0x8(%esp)
80102766:	00 
80102767:	89 44 24 04          	mov    %eax,0x4(%esp)
8010276b:	c7 04 24 f0 01 00 00 	movl   $0x1f0,(%esp)
80102772:	e8 13 fd ff ff       	call   8010248a <insl>
  
  // Wake process waiting for this buf.
  b->flags |= B_VALID;
80102777:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010277a:	8b 00                	mov    (%eax),%eax
8010277c:	89 c2                	mov    %eax,%edx
8010277e:	83 ca 02             	or     $0x2,%edx
80102781:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102784:	89 10                	mov    %edx,(%eax)
  b->flags &= ~B_DIRTY;
80102786:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102789:	8b 00                	mov    (%eax),%eax
8010278b:	89 c2                	mov    %eax,%edx
8010278d:	83 e2 fb             	and    $0xfffffffb,%edx
80102790:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102793:	89 10                	mov    %edx,(%eax)
  wakeup(b);
80102795:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102798:	89 04 24             	mov    %eax,(%esp)
8010279b:	e8 c2 22 00 00       	call   80104a62 <wakeup>
  
  // Start disk on next buf in queue.
  if(idequeue != 0)
801027a0:	a1 34 c6 10 80       	mov    0x8010c634,%eax
801027a5:	85 c0                	test   %eax,%eax
801027a7:	74 0d                	je     801027b6 <ideintr+0xb5>
    idestart(idequeue);
801027a9:	a1 34 c6 10 80       	mov    0x8010c634,%eax
801027ae:	89 04 24             	mov    %eax,(%esp)
801027b1:	e8 26 fe ff ff       	call   801025dc <idestart>

  release(&idelock);
801027b6:	c7 04 24 00 c6 10 80 	movl   $0x8010c600,(%esp)
801027bd:	e8 eb 24 00 00       	call   80104cad <release>
}
801027c2:	c9                   	leave  
801027c3:	c3                   	ret    

801027c4 <iderw>:
// Sync buf with disk. 
// If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID.
// Else if B_VALID is not set, read buf from disk, set B_VALID.
void
iderw(struct buf *b)
{
801027c4:	55                   	push   %ebp
801027c5:	89 e5                	mov    %esp,%ebp
801027c7:	83 ec 28             	sub    $0x28,%esp
  struct buf **pp;

  if(!(b->flags & B_BUSY))
801027ca:	8b 45 08             	mov    0x8(%ebp),%eax
801027cd:	8b 00                	mov    (%eax),%eax
801027cf:	83 e0 01             	and    $0x1,%eax
801027d2:	85 c0                	test   %eax,%eax
801027d4:	75 0c                	jne    801027e2 <iderw+0x1e>
    panic("iderw: buf not busy");
801027d6:	c7 04 24 d1 89 10 80 	movl   $0x801089d1,(%esp)
801027dd:	e8 73 dd ff ff       	call   80100555 <panic>
  if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
801027e2:	8b 45 08             	mov    0x8(%ebp),%eax
801027e5:	8b 00                	mov    (%eax),%eax
801027e7:	83 e0 06             	and    $0x6,%eax
801027ea:	83 f8 02             	cmp    $0x2,%eax
801027ed:	75 0c                	jne    801027fb <iderw+0x37>
    panic("iderw: nothing to do");
801027ef:	c7 04 24 e5 89 10 80 	movl   $0x801089e5,(%esp)
801027f6:	e8 5a dd ff ff       	call   80100555 <panic>
  if(b->dev != 0 && !havedisk1)
801027fb:	8b 45 08             	mov    0x8(%ebp),%eax
801027fe:	8b 40 04             	mov    0x4(%eax),%eax
80102801:	85 c0                	test   %eax,%eax
80102803:	74 15                	je     8010281a <iderw+0x56>
80102805:	a1 38 c6 10 80       	mov    0x8010c638,%eax
8010280a:	85 c0                	test   %eax,%eax
8010280c:	75 0c                	jne    8010281a <iderw+0x56>
    panic("iderw: ide disk 1 not present");
8010280e:	c7 04 24 fa 89 10 80 	movl   $0x801089fa,(%esp)
80102815:	e8 3b dd ff ff       	call   80100555 <panic>

  acquire(&idelock);  //DOC:acquire-lock
8010281a:	c7 04 24 00 c6 10 80 	movl   $0x8010c600,(%esp)
80102821:	e8 25 24 00 00       	call   80104c4b <acquire>

  // Append b to idequeue.
  b->qnext = 0;
80102826:	8b 45 08             	mov    0x8(%ebp),%eax
80102829:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
  for(pp=&idequeue; *pp; pp=&(*pp)->qnext)  //DOC:insert-queue
80102830:	c7 45 f4 34 c6 10 80 	movl   $0x8010c634,-0xc(%ebp)
80102837:	eb 0b                	jmp    80102844 <iderw+0x80>
80102839:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010283c:	8b 00                	mov    (%eax),%eax
8010283e:	83 c0 14             	add    $0x14,%eax
80102841:	89 45 f4             	mov    %eax,-0xc(%ebp)
80102844:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102847:	8b 00                	mov    (%eax),%eax
80102849:	85 c0                	test   %eax,%eax
8010284b:	75 ec                	jne    80102839 <iderw+0x75>
    ;
  *pp = b;
8010284d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102850:	8b 55 08             	mov    0x8(%ebp),%edx
80102853:	89 10                	mov    %edx,(%eax)
  
  // Start disk if necessary.
  if(idequeue == b)
80102855:	a1 34 c6 10 80       	mov    0x8010c634,%eax
8010285a:	3b 45 08             	cmp    0x8(%ebp),%eax
8010285d:	75 22                	jne    80102881 <iderw+0xbd>
    idestart(b);
8010285f:	8b 45 08             	mov    0x8(%ebp),%eax
80102862:	89 04 24             	mov    %eax,(%esp)
80102865:	e8 72 fd ff ff       	call   801025dc <idestart>
  
  // Wait for request to finish.
  while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
8010286a:	eb 15                	jmp    80102881 <iderw+0xbd>
    sleep(b, &idelock);
8010286c:	c7 44 24 04 00 c6 10 	movl   $0x8010c600,0x4(%esp)
80102873:	80 
80102874:	8b 45 08             	mov    0x8(%ebp),%eax
80102877:	89 04 24             	mov    %eax,(%esp)
8010287a:	e8 0a 21 00 00       	call   80104989 <sleep>
8010287f:	eb 01                	jmp    80102882 <iderw+0xbe>
  // Start disk if necessary.
  if(idequeue == b)
    idestart(b);
  
  // Wait for request to finish.
  while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
80102881:	90                   	nop
80102882:	8b 45 08             	mov    0x8(%ebp),%eax
80102885:	8b 00                	mov    (%eax),%eax
80102887:	83 e0 06             	and    $0x6,%eax
8010288a:	83 f8 02             	cmp    $0x2,%eax
8010288d:	75 dd                	jne    8010286c <iderw+0xa8>
    sleep(b, &idelock);
  }

  release(&idelock);
8010288f:	c7 04 24 00 c6 10 80 	movl   $0x8010c600,(%esp)
80102896:	e8 12 24 00 00       	call   80104cad <release>
}
8010289b:	c9                   	leave  
8010289c:	c3                   	ret    
8010289d:	00 00                	add    %al,(%eax)
	...

801028a0 <ioapicread>:
  uint data;
};

static uint
ioapicread(int reg)
{
801028a0:	55                   	push   %ebp
801028a1:	89 e5                	mov    %esp,%ebp
  ioapic->reg = reg;
801028a3:	a1 34 08 11 80       	mov    0x80110834,%eax
801028a8:	8b 55 08             	mov    0x8(%ebp),%edx
801028ab:	89 10                	mov    %edx,(%eax)
  return ioapic->data;
801028ad:	a1 34 08 11 80       	mov    0x80110834,%eax
801028b2:	8b 40 10             	mov    0x10(%eax),%eax
}
801028b5:	5d                   	pop    %ebp
801028b6:	c3                   	ret    

801028b7 <ioapicwrite>:

static void
ioapicwrite(int reg, uint data)
{
801028b7:	55                   	push   %ebp
801028b8:	89 e5                	mov    %esp,%ebp
  ioapic->reg = reg;
801028ba:	a1 34 08 11 80       	mov    0x80110834,%eax
801028bf:	8b 55 08             	mov    0x8(%ebp),%edx
801028c2:	89 10                	mov    %edx,(%eax)
  ioapic->data = data;
801028c4:	a1 34 08 11 80       	mov    0x80110834,%eax
801028c9:	8b 55 0c             	mov    0xc(%ebp),%edx
801028cc:	89 50 10             	mov    %edx,0x10(%eax)
}
801028cf:	5d                   	pop    %ebp
801028d0:	c3                   	ret    

801028d1 <ioapicinit>:

void
ioapicinit(void)
{
801028d1:	55                   	push   %ebp
801028d2:	89 e5                	mov    %esp,%ebp
801028d4:	83 ec 28             	sub    $0x28,%esp
  int i, id, maxintr;

  if(!ismp)
801028d7:	a1 24 09 11 80       	mov    0x80110924,%eax
801028dc:	85 c0                	test   %eax,%eax
801028de:	0f 84 9f 00 00 00    	je     80102983 <ioapicinit+0xb2>
    return;

  ioapic = (volatile struct ioapic*)IOAPIC;
801028e4:	c7 05 34 08 11 80 00 	movl   $0xfec00000,0x80110834
801028eb:	00 c0 fe 
  maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
801028ee:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
801028f5:	e8 a6 ff ff ff       	call   801028a0 <ioapicread>
801028fa:	c1 e8 10             	shr    $0x10,%eax
801028fd:	25 ff 00 00 00       	and    $0xff,%eax
80102902:	89 45 f0             	mov    %eax,-0x10(%ebp)
  id = ioapicread(REG_ID) >> 24;
80102905:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
8010290c:	e8 8f ff ff ff       	call   801028a0 <ioapicread>
80102911:	c1 e8 18             	shr    $0x18,%eax
80102914:	89 45 ec             	mov    %eax,-0x14(%ebp)
  if(id != ioapicid)
80102917:	0f b6 05 20 09 11 80 	movzbl 0x80110920,%eax
8010291e:	0f b6 c0             	movzbl %al,%eax
80102921:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80102924:	74 0c                	je     80102932 <ioapicinit+0x61>
    cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
80102926:	c7 04 24 18 8a 10 80 	movl   $0x80108a18,(%esp)
8010292d:	e8 6f da ff ff       	call   801003a1 <cprintf>

  // Mark all interrupts edge-triggered, active high, disabled,
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
80102932:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80102939:	eb 3e                	jmp    80102979 <ioapicinit+0xa8>
    ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
8010293b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010293e:	83 c0 20             	add    $0x20,%eax
80102941:	0d 00 00 01 00       	or     $0x10000,%eax
80102946:	8b 55 f4             	mov    -0xc(%ebp),%edx
80102949:	83 c2 08             	add    $0x8,%edx
8010294c:	01 d2                	add    %edx,%edx
8010294e:	89 44 24 04          	mov    %eax,0x4(%esp)
80102952:	89 14 24             	mov    %edx,(%esp)
80102955:	e8 5d ff ff ff       	call   801028b7 <ioapicwrite>
    ioapicwrite(REG_TABLE+2*i+1, 0);
8010295a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010295d:	83 c0 08             	add    $0x8,%eax
80102960:	01 c0                	add    %eax,%eax
80102962:	83 c0 01             	add    $0x1,%eax
80102965:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
8010296c:	00 
8010296d:	89 04 24             	mov    %eax,(%esp)
80102970:	e8 42 ff ff ff       	call   801028b7 <ioapicwrite>
  if(id != ioapicid)
    cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");

  // Mark all interrupts edge-triggered, active high, disabled,
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
80102975:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80102979:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010297c:	3b 45 f0             	cmp    -0x10(%ebp),%eax
8010297f:	7e ba                	jle    8010293b <ioapicinit+0x6a>
80102981:	eb 01                	jmp    80102984 <ioapicinit+0xb3>
ioapicinit(void)
{
  int i, id, maxintr;

  if(!ismp)
    return;
80102983:	90                   	nop
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
    ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
    ioapicwrite(REG_TABLE+2*i+1, 0);
  }
}
80102984:	c9                   	leave  
80102985:	c3                   	ret    

80102986 <ioapicenable>:

void
ioapicenable(int irq, int cpunum)
{
80102986:	55                   	push   %ebp
80102987:	89 e5                	mov    %esp,%ebp
80102989:	83 ec 08             	sub    $0x8,%esp
  if(!ismp)
8010298c:	a1 24 09 11 80       	mov    0x80110924,%eax
80102991:	85 c0                	test   %eax,%eax
80102993:	74 39                	je     801029ce <ioapicenable+0x48>
    return;

  // Mark interrupt edge-triggered, active high,
  // enabled, and routed to the given cpunum,
  // which happens to be that cpu's APIC ID.
  ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
80102995:	8b 45 08             	mov    0x8(%ebp),%eax
80102998:	83 c0 20             	add    $0x20,%eax
8010299b:	8b 55 08             	mov    0x8(%ebp),%edx
8010299e:	83 c2 08             	add    $0x8,%edx
801029a1:	01 d2                	add    %edx,%edx
801029a3:	89 44 24 04          	mov    %eax,0x4(%esp)
801029a7:	89 14 24             	mov    %edx,(%esp)
801029aa:	e8 08 ff ff ff       	call   801028b7 <ioapicwrite>
  ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
801029af:	8b 45 0c             	mov    0xc(%ebp),%eax
801029b2:	c1 e0 18             	shl    $0x18,%eax
801029b5:	8b 55 08             	mov    0x8(%ebp),%edx
801029b8:	83 c2 08             	add    $0x8,%edx
801029bb:	01 d2                	add    %edx,%edx
801029bd:	83 c2 01             	add    $0x1,%edx
801029c0:	89 44 24 04          	mov    %eax,0x4(%esp)
801029c4:	89 14 24             	mov    %edx,(%esp)
801029c7:	e8 eb fe ff ff       	call   801028b7 <ioapicwrite>
801029cc:	eb 01                	jmp    801029cf <ioapicenable+0x49>

void
ioapicenable(int irq, int cpunum)
{
  if(!ismp)
    return;
801029ce:	90                   	nop
  // Mark interrupt edge-triggered, active high,
  // enabled, and routed to the given cpunum,
  // which happens to be that cpu's APIC ID.
  ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
  ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
}
801029cf:	c9                   	leave  
801029d0:	c3                   	ret    
801029d1:	00 00                	add    %al,(%eax)
	...

801029d4 <v2p>:
#define KERNBASE 0x80000000         // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM)  // Address where kernel is linked

#ifndef __ASSEMBLER__

static inline uint v2p(void *a) { return ((uint) (a))  - KERNBASE; }
801029d4:	55                   	push   %ebp
801029d5:	89 e5                	mov    %esp,%ebp
801029d7:	8b 45 08             	mov    0x8(%ebp),%eax
801029da:	05 00 00 00 80       	add    $0x80000000,%eax
801029df:	5d                   	pop    %ebp
801029e0:	c3                   	ret    

801029e1 <kinit1>:
// the pages mapped by entrypgdir on free list.
// 2. main() calls kinit2() with the rest of the physical pages
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
801029e1:	55                   	push   %ebp
801029e2:	89 e5                	mov    %esp,%ebp
801029e4:	83 ec 18             	sub    $0x18,%esp
  initlock(&kmem.lock, "kmem");
801029e7:	c7 44 24 04 4c 8a 10 	movl   $0x80108a4c,0x4(%esp)
801029ee:	80 
801029ef:	c7 04 24 40 08 11 80 	movl   $0x80110840,(%esp)
801029f6:	e8 2f 22 00 00       	call   80104c2a <initlock>
  kmem.use_lock = 0;
801029fb:	c7 05 74 08 11 80 00 	movl   $0x0,0x80110874
80102a02:	00 00 00 
  freerange(vstart, vend);
80102a05:	8b 45 0c             	mov    0xc(%ebp),%eax
80102a08:	89 44 24 04          	mov    %eax,0x4(%esp)
80102a0c:	8b 45 08             	mov    0x8(%ebp),%eax
80102a0f:	89 04 24             	mov    %eax,(%esp)
80102a12:	e8 28 01 00 00       	call   80102b3f <freerange>

  left_mem = -2;
80102a17:	c7 05 7c 08 11 80 fe 	movl   $0xfffffffe,0x8011087c
80102a1e:	ff ff ff 
}
80102a21:	c9                   	leave  
80102a22:	c3                   	ret    

80102a23 <kinit2>:

void
kinit2(void *vstart, void *vend)
{
80102a23:	55                   	push   %ebp
80102a24:	89 e5                	mov    %esp,%ebp
80102a26:	83 ec 18             	sub    $0x18,%esp

  freerange(vstart, vend);
80102a29:	8b 45 0c             	mov    0xc(%ebp),%eax
80102a2c:	89 44 24 04          	mov    %eax,0x4(%esp)
80102a30:	8b 45 08             	mov    0x8(%ebp),%eax
80102a33:	89 04 24             	mov    %eax,(%esp)
80102a36:	e8 04 01 00 00       	call   80102b3f <freerange>
  kmem.use_lock = 1;
80102a3b:	c7 05 74 08 11 80 01 	movl   $0x1,0x80110874
80102a42:	00 00 00 

  cprintf("[kinit2]\tvstart=%x\tvend=%x\n", vstart, vend);
80102a45:	8b 45 0c             	mov    0xc(%ebp),%eax
80102a48:	89 44 24 08          	mov    %eax,0x8(%esp)
80102a4c:	8b 45 08             	mov    0x8(%ebp),%eax
80102a4f:	89 44 24 04          	mov    %eax,0x4(%esp)
80102a53:	c7 04 24 51 8a 10 80 	movl   $0x80108a51,(%esp)
80102a5a:	e8 42 d9 ff ff       	call   801003a1 <cprintf>

  left_mem = -2;
80102a5f:	c7 05 7c 08 11 80 fe 	movl   $0xfffffffe,0x8011087c
80102a66:	ff ff ff 
  //cprintf("*** kmem.use_lock = %d", kmem.use_lock);
  //kmem_show("init2");
}
80102a69:	c9                   	leave  
80102a6a:	c3                   	ret    

80102a6b <kmem_show>:

void kmem_show(char *add_txt)
{
80102a6b:	55                   	push   %ebp
80102a6c:	89 e5                	mov    %esp,%ebp
80102a6e:	83 ec 38             	sub    $0x38,%esp
  struct run *r;
  int count = 0;
80102a71:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)

  if(left_mem == -2)
80102a78:	a1 7c 08 11 80       	mov    0x8011087c,%eax
80102a7d:	83 f8 fe             	cmp    $0xfffffffe,%eax
80102a80:	75 71                	jne    80102af3 <kmem_show+0x88>
  {
      r = kmem.freelist;
80102a82:	a1 78 08 11 80       	mov    0x80110878,%eax
80102a87:	89 45 f4             	mov    %eax,-0xc(%ebp)
      while(r)
80102a8a:	eb 57                	jmp    80102ae3 <kmem_show+0x78>
      {
        if(r->next) ;
80102a8c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102a8f:	8b 00                	mov    (%eax),%eax
80102a91:	85 c0                	test   %eax,%eax
80102a93:	75 42                	jne    80102ad7 <kmem_show+0x6c>
        else cprintf("[%s]\tkmem\t%x\tr = %p\tcount = %d %s\n",add_txt,&kmem,r,(count*4096)/1024,"KBs");
80102a95:	8b 45 f0             	mov    -0x10(%ebp),%eax
80102a98:	c1 e0 0c             	shl    $0xc,%eax
80102a9b:	8d 90 ff 03 00 00    	lea    0x3ff(%eax),%edx
80102aa1:	85 c0                	test   %eax,%eax
80102aa3:	0f 48 c2             	cmovs  %edx,%eax
80102aa6:	c1 f8 0a             	sar    $0xa,%eax
80102aa9:	c7 44 24 14 6d 8a 10 	movl   $0x80108a6d,0x14(%esp)
80102ab0:	80 
80102ab1:	89 44 24 10          	mov    %eax,0x10(%esp)
80102ab5:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102ab8:	89 44 24 0c          	mov    %eax,0xc(%esp)
80102abc:	c7 44 24 08 40 08 11 	movl   $0x80110840,0x8(%esp)
80102ac3:	80 
80102ac4:	8b 45 08             	mov    0x8(%ebp),%eax
80102ac7:	89 44 24 04          	mov    %eax,0x4(%esp)
80102acb:	c7 04 24 74 8a 10 80 	movl   $0x80108a74,(%esp)
80102ad2:	e8 ca d8 ff ff       	call   801003a1 <cprintf>
        r = r->next;
80102ad7:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102ada:	8b 00                	mov    (%eax),%eax
80102adc:	89 45 f4             	mov    %eax,-0xc(%ebp)
        count ++;
80102adf:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
  int count = 0;

  if(left_mem == -2)
  {
      r = kmem.freelist;
      while(r)
80102ae3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80102ae7:	75 a3                	jne    80102a8c <kmem_show+0x21>
        if(r->next) ;
        else cprintf("[%s]\tkmem\t%x\tr = %p\tcount = %d %s\n",add_txt,&kmem,r,(count*4096)/1024,"KBs");
        r = r->next;
        count ++;
      }
      left_mem = count;
80102ae9:	8b 45 f0             	mov    -0x10(%ebp),%eax
80102aec:	a3 7c 08 11 80       	mov    %eax,0x8011087c
80102af1:	eb 4a                	jmp    80102b3d <kmem_show+0xd2>
  }
  else
  {
      left_mem --;
80102af3:	a1 7c 08 11 80       	mov    0x8011087c,%eax
80102af8:	83 e8 01             	sub    $0x1,%eax
80102afb:	a3 7c 08 11 80       	mov    %eax,0x8011087c
      cprintf("[%s]\tkmem\t%x\tleft mem = %d %s\n",add_txt,&kmem,(left_mem*4096)/1024,"KBs");
80102b00:	a1 7c 08 11 80       	mov    0x8011087c,%eax
80102b05:	c1 e0 0c             	shl    $0xc,%eax
80102b08:	8d 90 ff 03 00 00    	lea    0x3ff(%eax),%edx
80102b0e:	85 c0                	test   %eax,%eax
80102b10:	0f 48 c2             	cmovs  %edx,%eax
80102b13:	c1 f8 0a             	sar    $0xa,%eax
80102b16:	c7 44 24 10 6d 8a 10 	movl   $0x80108a6d,0x10(%esp)
80102b1d:	80 
80102b1e:	89 44 24 0c          	mov    %eax,0xc(%esp)
80102b22:	c7 44 24 08 40 08 11 	movl   $0x80110840,0x8(%esp)
80102b29:	80 
80102b2a:	8b 45 08             	mov    0x8(%ebp),%eax
80102b2d:	89 44 24 04          	mov    %eax,0x4(%esp)
80102b31:	c7 04 24 98 8a 10 80 	movl   $0x80108a98,(%esp)
80102b38:	e8 64 d8 ff ff       	call   801003a1 <cprintf>
  }

}
80102b3d:	c9                   	leave  
80102b3e:	c3                   	ret    

80102b3f <freerange>:

void
freerange(void *vstart, void *vend)
{
80102b3f:	55                   	push   %ebp
80102b40:	89 e5                	mov    %esp,%ebp
80102b42:	83 ec 28             	sub    $0x28,%esp
  char *p;
  p = (char*)PGROUNDUP((uint)vstart);
80102b45:	8b 45 08             	mov    0x8(%ebp),%eax
80102b48:	05 ff 0f 00 00       	add    $0xfff,%eax
80102b4d:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80102b52:	89 45 f4             	mov    %eax,-0xc(%ebp)
  for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102b55:	eb 12                	jmp    80102b69 <freerange+0x2a>
    kfree(p);
80102b57:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102b5a:	89 04 24             	mov    %eax,(%esp)
80102b5d:	e8 16 00 00 00       	call   80102b78 <kfree>
void
freerange(void *vstart, void *vend)
{
  char *p;
  p = (char*)PGROUNDUP((uint)vstart);
  for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102b62:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
80102b69:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102b6c:	05 00 10 00 00       	add    $0x1000,%eax
80102b71:	3b 45 0c             	cmp    0xc(%ebp),%eax
80102b74:	76 e1                	jbe    80102b57 <freerange+0x18>
    kfree(p);
}
80102b76:	c9                   	leave  
80102b77:	c3                   	ret    

80102b78 <kfree>:
// which normally should have been returned by a
// call to kalloc().  (The exception is when
// initializing the allocator; see kinit above.)
void
kfree(char *v)
{
80102b78:	55                   	push   %ebp
80102b79:	89 e5                	mov    %esp,%ebp
80102b7b:	83 ec 28             	sub    $0x28,%esp
  struct run *r;

  if((uint)v % PGSIZE || v < end || v2p(v) >= PHYSTOP)
80102b7e:	8b 45 08             	mov    0x8(%ebp),%eax
80102b81:	25 ff 0f 00 00       	and    $0xfff,%eax
80102b86:	85 c0                	test   %eax,%eax
80102b88:	75 1b                	jne    80102ba5 <kfree+0x2d>
80102b8a:	81 7d 08 20 37 11 80 	cmpl   $0x80113720,0x8(%ebp)
80102b91:	72 12                	jb     80102ba5 <kfree+0x2d>
80102b93:	8b 45 08             	mov    0x8(%ebp),%eax
80102b96:	89 04 24             	mov    %eax,(%esp)
80102b99:	e8 36 fe ff ff       	call   801029d4 <v2p>
80102b9e:	3d ff ff ff 0d       	cmp    $0xdffffff,%eax
80102ba3:	76 0c                	jbe    80102bb1 <kfree+0x39>
    panic("kfree");
80102ba5:	c7 04 24 b7 8a 10 80 	movl   $0x80108ab7,(%esp)
80102bac:	e8 a4 d9 ff ff       	call   80100555 <panic>

  // Fill with junk to catch dangling refs.
  memset(v, 1, PGSIZE);
80102bb1:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80102bb8:	00 
80102bb9:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80102bc0:	00 
80102bc1:	8b 45 08             	mov    0x8(%ebp),%eax
80102bc4:	89 04 24             	mov    %eax,(%esp)
80102bc7:	e8 ce 22 00 00       	call   80104e9a <memset>

  if(kmem.use_lock)
80102bcc:	a1 74 08 11 80       	mov    0x80110874,%eax
80102bd1:	85 c0                	test   %eax,%eax
80102bd3:	74 0c                	je     80102be1 <kfree+0x69>
    acquire(&kmem.lock);
80102bd5:	c7 04 24 40 08 11 80 	movl   $0x80110840,(%esp)
80102bdc:	e8 6a 20 00 00       	call   80104c4b <acquire>
  r = (struct run*)v;
80102be1:	8b 45 08             	mov    0x8(%ebp),%eax
80102be4:	89 45 f4             	mov    %eax,-0xc(%ebp)
  r->next = kmem.freelist;
80102be7:	8b 15 78 08 11 80    	mov    0x80110878,%edx
80102bed:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102bf0:	89 10                	mov    %edx,(%eax)
  kmem.freelist = r;
80102bf2:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102bf5:	a3 78 08 11 80       	mov    %eax,0x80110878
  if(kmem.use_lock)
80102bfa:	a1 74 08 11 80       	mov    0x80110874,%eax
80102bff:	85 c0                	test   %eax,%eax
80102c01:	74 0c                	je     80102c0f <kfree+0x97>
    release(&kmem.lock);
80102c03:	c7 04 24 40 08 11 80 	movl   $0x80110840,(%esp)
80102c0a:	e8 9e 20 00 00       	call   80104cad <release>
    //cprintf("%d", kmem.use_lock);
//  if(left_mem != -2)
//  {
//      left_mem ++;
//  }
}
80102c0f:	c9                   	leave  
80102c10:	c3                   	ret    

80102c11 <kalloc>:
// Allocate one 4096-byte page of physical memory.
// Returns a pointer that the kernel can use.
// Returns 0 if the memory cannot be allocated.
char*
kalloc(void)
{
80102c11:	55                   	push   %ebp
80102c12:	89 e5                	mov    %esp,%ebp
80102c14:	83 ec 28             	sub    $0x28,%esp
  struct run *r;

  if(kmem.use_lock)
80102c17:	a1 74 08 11 80       	mov    0x80110874,%eax
80102c1c:	85 c0                	test   %eax,%eax
80102c1e:	74 0c                	je     80102c2c <kalloc+0x1b>
    acquire(&kmem.lock);
80102c20:	c7 04 24 40 08 11 80 	movl   $0x80110840,(%esp)
80102c27:	e8 1f 20 00 00       	call   80104c4b <acquire>
  r = kmem.freelist;
80102c2c:	a1 78 08 11 80       	mov    0x80110878,%eax
80102c31:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(r)
80102c34:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80102c38:	74 0a                	je     80102c44 <kalloc+0x33>
    kmem.freelist = r->next;
80102c3a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102c3d:	8b 00                	mov    (%eax),%eax
80102c3f:	a3 78 08 11 80       	mov    %eax,0x80110878
  if(kmem.use_lock)
80102c44:	a1 74 08 11 80       	mov    0x80110874,%eax
80102c49:	85 c0                	test   %eax,%eax
80102c4b:	74 0c                	je     80102c59 <kalloc+0x48>
    release(&kmem.lock);
80102c4d:	c7 04 24 40 08 11 80 	movl   $0x80110840,(%esp)
80102c54:	e8 54 20 00 00       	call   80104cad <release>

  //kmem_show("alloc");


  return (char*)r;
80102c59:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80102c5c:	c9                   	leave  
80102c5d:	c3                   	ret    
	...

80102c60 <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
80102c60:	55                   	push   %ebp
80102c61:	89 e5                	mov    %esp,%ebp
80102c63:	53                   	push   %ebx
80102c64:	83 ec 14             	sub    $0x14,%esp
80102c67:	8b 45 08             	mov    0x8(%ebp),%eax
80102c6a:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102c6e:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
80102c72:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
80102c76:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
80102c7a:	ec                   	in     (%dx),%al
80102c7b:	89 c3                	mov    %eax,%ebx
80102c7d:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
80102c80:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
80102c84:	83 c4 14             	add    $0x14,%esp
80102c87:	5b                   	pop    %ebx
80102c88:	5d                   	pop    %ebp
80102c89:	c3                   	ret    

80102c8a <kbdgetc>:
#include "defs.h"
#include "kbd.h"

int
kbdgetc(void)
{
80102c8a:	55                   	push   %ebp
80102c8b:	89 e5                	mov    %esp,%ebp
80102c8d:	83 ec 14             	sub    $0x14,%esp
  static uchar *charcode[4] = {
    normalmap, shiftmap, ctlmap, ctlmap
  };
  uint st, data, c;

  st = inb(KBSTATP);
80102c90:	c7 04 24 64 00 00 00 	movl   $0x64,(%esp)
80102c97:	e8 c4 ff ff ff       	call   80102c60 <inb>
80102c9c:	0f b6 c0             	movzbl %al,%eax
80102c9f:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if((st & KBS_DIB) == 0)
80102ca2:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102ca5:	83 e0 01             	and    $0x1,%eax
80102ca8:	85 c0                	test   %eax,%eax
80102caa:	75 0a                	jne    80102cb6 <kbdgetc+0x2c>
    return -1;
80102cac:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80102cb1:	e9 23 01 00 00       	jmp    80102dd9 <kbdgetc+0x14f>
  data = inb(KBDATAP);
80102cb6:	c7 04 24 60 00 00 00 	movl   $0x60,(%esp)
80102cbd:	e8 9e ff ff ff       	call   80102c60 <inb>
80102cc2:	0f b6 c0             	movzbl %al,%eax
80102cc5:	89 45 fc             	mov    %eax,-0x4(%ebp)

  if(data == 0xE0){
80102cc8:	81 7d fc e0 00 00 00 	cmpl   $0xe0,-0x4(%ebp)
80102ccf:	75 17                	jne    80102ce8 <kbdgetc+0x5e>
    shift |= E0ESC;
80102cd1:	a1 3c c6 10 80       	mov    0x8010c63c,%eax
80102cd6:	83 c8 40             	or     $0x40,%eax
80102cd9:	a3 3c c6 10 80       	mov    %eax,0x8010c63c
    return 0;
80102cde:	b8 00 00 00 00       	mov    $0x0,%eax
80102ce3:	e9 f1 00 00 00       	jmp    80102dd9 <kbdgetc+0x14f>
  } else if(data & 0x80){
80102ce8:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102ceb:	25 80 00 00 00       	and    $0x80,%eax
80102cf0:	85 c0                	test   %eax,%eax
80102cf2:	74 45                	je     80102d39 <kbdgetc+0xaf>
    // Key released
    data = (shift & E0ESC ? data : data & 0x7F);
80102cf4:	a1 3c c6 10 80       	mov    0x8010c63c,%eax
80102cf9:	83 e0 40             	and    $0x40,%eax
80102cfc:	85 c0                	test   %eax,%eax
80102cfe:	75 08                	jne    80102d08 <kbdgetc+0x7e>
80102d00:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102d03:	83 e0 7f             	and    $0x7f,%eax
80102d06:	eb 03                	jmp    80102d0b <kbdgetc+0x81>
80102d08:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102d0b:	89 45 fc             	mov    %eax,-0x4(%ebp)
    shift &= ~(shiftcode[data] | E0ESC);
80102d0e:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102d11:	05 20 a0 10 80       	add    $0x8010a020,%eax
80102d16:	0f b6 00             	movzbl (%eax),%eax
80102d19:	83 c8 40             	or     $0x40,%eax
80102d1c:	0f b6 c0             	movzbl %al,%eax
80102d1f:	f7 d0                	not    %eax
80102d21:	89 c2                	mov    %eax,%edx
80102d23:	a1 3c c6 10 80       	mov    0x8010c63c,%eax
80102d28:	21 d0                	and    %edx,%eax
80102d2a:	a3 3c c6 10 80       	mov    %eax,0x8010c63c
    return 0;
80102d2f:	b8 00 00 00 00       	mov    $0x0,%eax
80102d34:	e9 a0 00 00 00       	jmp    80102dd9 <kbdgetc+0x14f>
  } else if(shift & E0ESC){
80102d39:	a1 3c c6 10 80       	mov    0x8010c63c,%eax
80102d3e:	83 e0 40             	and    $0x40,%eax
80102d41:	85 c0                	test   %eax,%eax
80102d43:	74 14                	je     80102d59 <kbdgetc+0xcf>
    // Last character was an E0 escape; or with 0x80
    data |= 0x80;
80102d45:	81 4d fc 80 00 00 00 	orl    $0x80,-0x4(%ebp)
    shift &= ~E0ESC;
80102d4c:	a1 3c c6 10 80       	mov    0x8010c63c,%eax
80102d51:	83 e0 bf             	and    $0xffffffbf,%eax
80102d54:	a3 3c c6 10 80       	mov    %eax,0x8010c63c
  }

  shift |= shiftcode[data];
80102d59:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102d5c:	05 20 a0 10 80       	add    $0x8010a020,%eax
80102d61:	0f b6 00             	movzbl (%eax),%eax
80102d64:	0f b6 d0             	movzbl %al,%edx
80102d67:	a1 3c c6 10 80       	mov    0x8010c63c,%eax
80102d6c:	09 d0                	or     %edx,%eax
80102d6e:	a3 3c c6 10 80       	mov    %eax,0x8010c63c
  shift ^= togglecode[data];
80102d73:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102d76:	05 20 a1 10 80       	add    $0x8010a120,%eax
80102d7b:	0f b6 00             	movzbl (%eax),%eax
80102d7e:	0f b6 d0             	movzbl %al,%edx
80102d81:	a1 3c c6 10 80       	mov    0x8010c63c,%eax
80102d86:	31 d0                	xor    %edx,%eax
80102d88:	a3 3c c6 10 80       	mov    %eax,0x8010c63c
  c = charcode[shift & (CTL | SHIFT)][data];
80102d8d:	a1 3c c6 10 80       	mov    0x8010c63c,%eax
80102d92:	83 e0 03             	and    $0x3,%eax
80102d95:	8b 04 85 20 a5 10 80 	mov    -0x7fef5ae0(,%eax,4),%eax
80102d9c:	03 45 fc             	add    -0x4(%ebp),%eax
80102d9f:	0f b6 00             	movzbl (%eax),%eax
80102da2:	0f b6 c0             	movzbl %al,%eax
80102da5:	89 45 f8             	mov    %eax,-0x8(%ebp)
  if(shift & CAPSLOCK){
80102da8:	a1 3c c6 10 80       	mov    0x8010c63c,%eax
80102dad:	83 e0 08             	and    $0x8,%eax
80102db0:	85 c0                	test   %eax,%eax
80102db2:	74 22                	je     80102dd6 <kbdgetc+0x14c>
    if('a' <= c && c <= 'z')
80102db4:	83 7d f8 60          	cmpl   $0x60,-0x8(%ebp)
80102db8:	76 0c                	jbe    80102dc6 <kbdgetc+0x13c>
80102dba:	83 7d f8 7a          	cmpl   $0x7a,-0x8(%ebp)
80102dbe:	77 06                	ja     80102dc6 <kbdgetc+0x13c>
      c += 'A' - 'a';
80102dc0:	83 6d f8 20          	subl   $0x20,-0x8(%ebp)
80102dc4:	eb 10                	jmp    80102dd6 <kbdgetc+0x14c>
    else if('A' <= c && c <= 'Z')
80102dc6:	83 7d f8 40          	cmpl   $0x40,-0x8(%ebp)
80102dca:	76 0a                	jbe    80102dd6 <kbdgetc+0x14c>
80102dcc:	83 7d f8 5a          	cmpl   $0x5a,-0x8(%ebp)
80102dd0:	77 04                	ja     80102dd6 <kbdgetc+0x14c>
      c += 'a' - 'A';
80102dd2:	83 45 f8 20          	addl   $0x20,-0x8(%ebp)
  }
  return c;
80102dd6:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80102dd9:	c9                   	leave  
80102dda:	c3                   	ret    

80102ddb <kbdintr>:

void
kbdintr(void)
{
80102ddb:	55                   	push   %ebp
80102ddc:	89 e5                	mov    %esp,%ebp
80102dde:	83 ec 18             	sub    $0x18,%esp
  consoleintr(kbdgetc);
80102de1:	c7 04 24 8a 2c 10 80 	movl   $0x80102c8a,(%esp)
80102de8:	e8 d8 d9 ff ff       	call   801007c5 <consoleintr>
}
80102ded:	c9                   	leave  
80102dee:	c3                   	ret    
	...

80102df0 <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
80102df0:	55                   	push   %ebp
80102df1:	89 e5                	mov    %esp,%ebp
80102df3:	83 ec 08             	sub    $0x8,%esp
80102df6:	8b 55 08             	mov    0x8(%ebp),%edx
80102df9:	8b 45 0c             	mov    0xc(%ebp),%eax
80102dfc:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
80102e00:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102e03:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80102e07:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80102e0b:	ee                   	out    %al,(%dx)
}
80102e0c:	c9                   	leave  
80102e0d:	c3                   	ret    

80102e0e <readeflags>:
  asm volatile("ltr %0" : : "r" (sel));
}

static inline uint
readeflags(void)
{
80102e0e:	55                   	push   %ebp
80102e0f:	89 e5                	mov    %esp,%ebp
80102e11:	53                   	push   %ebx
80102e12:	83 ec 10             	sub    $0x10,%esp
  uint eflags;
  asm volatile("pushfl; popl %0" : "=r" (eflags));
80102e15:	9c                   	pushf  
80102e16:	5b                   	pop    %ebx
80102e17:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  return eflags;
80102e1a:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80102e1d:	83 c4 10             	add    $0x10,%esp
80102e20:	5b                   	pop    %ebx
80102e21:	5d                   	pop    %ebp
80102e22:	c3                   	ret    

80102e23 <lapicw>:

volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
80102e23:	55                   	push   %ebp
80102e24:	89 e5                	mov    %esp,%ebp
  lapic[index] = value;
80102e26:	a1 80 08 11 80       	mov    0x80110880,%eax
80102e2b:	8b 55 08             	mov    0x8(%ebp),%edx
80102e2e:	c1 e2 02             	shl    $0x2,%edx
80102e31:	01 c2                	add    %eax,%edx
80102e33:	8b 45 0c             	mov    0xc(%ebp),%eax
80102e36:	89 02                	mov    %eax,(%edx)
  lapic[ID];  // wait for write to finish, by reading
80102e38:	a1 80 08 11 80       	mov    0x80110880,%eax
80102e3d:	83 c0 20             	add    $0x20,%eax
80102e40:	8b 00                	mov    (%eax),%eax
}
80102e42:	5d                   	pop    %ebp
80102e43:	c3                   	ret    

80102e44 <lapicinit>:
//PAGEBREAK!

void
lapicinit(void)
{
80102e44:	55                   	push   %ebp
80102e45:	89 e5                	mov    %esp,%ebp
80102e47:	83 ec 08             	sub    $0x8,%esp
  if(!lapic) 
80102e4a:	a1 80 08 11 80       	mov    0x80110880,%eax
80102e4f:	85 c0                	test   %eax,%eax
80102e51:	0f 84 47 01 00 00    	je     80102f9e <lapicinit+0x15a>
    return;

  // Enable local APIC; set spurious interrupt vector.
  lapicw(SVR, ENABLE | (T_IRQ0 + IRQ_SPURIOUS));
80102e57:	c7 44 24 04 3f 01 00 	movl   $0x13f,0x4(%esp)
80102e5e:	00 
80102e5f:	c7 04 24 3c 00 00 00 	movl   $0x3c,(%esp)
80102e66:	e8 b8 ff ff ff       	call   80102e23 <lapicw>

  // The timer repeatedly counts down at bus frequency
  // from lapic[TICR] and then issues an interrupt.  
  // If xv6 cared more about precise timekeeping,
  // TICR would be calibrated using an external time source.
  lapicw(TDCR, X1);
80102e6b:	c7 44 24 04 0b 00 00 	movl   $0xb,0x4(%esp)
80102e72:	00 
80102e73:	c7 04 24 f8 00 00 00 	movl   $0xf8,(%esp)
80102e7a:	e8 a4 ff ff ff       	call   80102e23 <lapicw>
  lapicw(TIMER, PERIODIC | (T_IRQ0 + IRQ_TIMER));
80102e7f:	c7 44 24 04 20 00 02 	movl   $0x20020,0x4(%esp)
80102e86:	00 
80102e87:	c7 04 24 c8 00 00 00 	movl   $0xc8,(%esp)
80102e8e:	e8 90 ff ff ff       	call   80102e23 <lapicw>
  lapicw(TICR, 10000000); 
80102e93:	c7 44 24 04 80 96 98 	movl   $0x989680,0x4(%esp)
80102e9a:	00 
80102e9b:	c7 04 24 e0 00 00 00 	movl   $0xe0,(%esp)
80102ea2:	e8 7c ff ff ff       	call   80102e23 <lapicw>

  // Disable logical interrupt lines.
  lapicw(LINT0, MASKED);
80102ea7:	c7 44 24 04 00 00 01 	movl   $0x10000,0x4(%esp)
80102eae:	00 
80102eaf:	c7 04 24 d4 00 00 00 	movl   $0xd4,(%esp)
80102eb6:	e8 68 ff ff ff       	call   80102e23 <lapicw>
  lapicw(LINT1, MASKED);
80102ebb:	c7 44 24 04 00 00 01 	movl   $0x10000,0x4(%esp)
80102ec2:	00 
80102ec3:	c7 04 24 d8 00 00 00 	movl   $0xd8,(%esp)
80102eca:	e8 54 ff ff ff       	call   80102e23 <lapicw>

  // Disable performance counter overflow interrupts
  // on machines that provide that interrupt entry.
  if(((lapic[VER]>>16) & 0xFF) >= 4)
80102ecf:	a1 80 08 11 80       	mov    0x80110880,%eax
80102ed4:	83 c0 30             	add    $0x30,%eax
80102ed7:	8b 00                	mov    (%eax),%eax
80102ed9:	c1 e8 10             	shr    $0x10,%eax
80102edc:	25 ff 00 00 00       	and    $0xff,%eax
80102ee1:	83 f8 03             	cmp    $0x3,%eax
80102ee4:	76 14                	jbe    80102efa <lapicinit+0xb6>
    lapicw(PCINT, MASKED);
80102ee6:	c7 44 24 04 00 00 01 	movl   $0x10000,0x4(%esp)
80102eed:	00 
80102eee:	c7 04 24 d0 00 00 00 	movl   $0xd0,(%esp)
80102ef5:	e8 29 ff ff ff       	call   80102e23 <lapicw>

  // Map error interrupt to IRQ_ERROR.
  lapicw(ERROR, T_IRQ0 + IRQ_ERROR);
80102efa:	c7 44 24 04 33 00 00 	movl   $0x33,0x4(%esp)
80102f01:	00 
80102f02:	c7 04 24 dc 00 00 00 	movl   $0xdc,(%esp)
80102f09:	e8 15 ff ff ff       	call   80102e23 <lapicw>

  // Clear error status register (requires back-to-back writes).
  lapicw(ESR, 0);
80102f0e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102f15:	00 
80102f16:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80102f1d:	e8 01 ff ff ff       	call   80102e23 <lapicw>
  lapicw(ESR, 0);
80102f22:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102f29:	00 
80102f2a:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80102f31:	e8 ed fe ff ff       	call   80102e23 <lapicw>

  // Ack any outstanding interrupts.
  lapicw(EOI, 0);
80102f36:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102f3d:	00 
80102f3e:	c7 04 24 2c 00 00 00 	movl   $0x2c,(%esp)
80102f45:	e8 d9 fe ff ff       	call   80102e23 <lapicw>

  // Send an Init Level De-Assert to synchronise arbitration ID's.
  lapicw(ICRHI, 0);
80102f4a:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102f51:	00 
80102f52:	c7 04 24 c4 00 00 00 	movl   $0xc4,(%esp)
80102f59:	e8 c5 fe ff ff       	call   80102e23 <lapicw>
  lapicw(ICRLO, BCAST | INIT | LEVEL);
80102f5e:	c7 44 24 04 00 85 08 	movl   $0x88500,0x4(%esp)
80102f65:	00 
80102f66:	c7 04 24 c0 00 00 00 	movl   $0xc0,(%esp)
80102f6d:	e8 b1 fe ff ff       	call   80102e23 <lapicw>
  while(lapic[ICRLO] & DELIVS)
80102f72:	90                   	nop
80102f73:	a1 80 08 11 80       	mov    0x80110880,%eax
80102f78:	05 00 03 00 00       	add    $0x300,%eax
80102f7d:	8b 00                	mov    (%eax),%eax
80102f7f:	25 00 10 00 00       	and    $0x1000,%eax
80102f84:	85 c0                	test   %eax,%eax
80102f86:	75 eb                	jne    80102f73 <lapicinit+0x12f>
    ;

  // Enable interrupts on the APIC (but not on the processor).
  lapicw(TPR, 0);
80102f88:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102f8f:	00 
80102f90:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
80102f97:	e8 87 fe ff ff       	call   80102e23 <lapicw>
80102f9c:	eb 01                	jmp    80102f9f <lapicinit+0x15b>

void
lapicinit(void)
{
  if(!lapic) 
    return;
80102f9e:	90                   	nop
  while(lapic[ICRLO] & DELIVS)
    ;

  // Enable interrupts on the APIC (but not on the processor).
  lapicw(TPR, 0);
}
80102f9f:	c9                   	leave  
80102fa0:	c3                   	ret    

80102fa1 <cpunum>:

int
cpunum(void)
{
80102fa1:	55                   	push   %ebp
80102fa2:	89 e5                	mov    %esp,%ebp
80102fa4:	83 ec 18             	sub    $0x18,%esp
  // Cannot call cpu when interrupts are enabled:
  // result not guaranteed to last long enough to be used!
  // Would prefer to panic but even printing is chancy here:
  // almost everything, including cprintf and panic, calls cpu,
  // often indirectly through acquire and release.
  if(readeflags()&FL_IF){
80102fa7:	e8 62 fe ff ff       	call   80102e0e <readeflags>
80102fac:	25 00 02 00 00       	and    $0x200,%eax
80102fb1:	85 c0                	test   %eax,%eax
80102fb3:	74 29                	je     80102fde <cpunum+0x3d>
    static int n;
    if(n++ == 0)
80102fb5:	a1 40 c6 10 80       	mov    0x8010c640,%eax
80102fba:	85 c0                	test   %eax,%eax
80102fbc:	0f 94 c2             	sete   %dl
80102fbf:	83 c0 01             	add    $0x1,%eax
80102fc2:	a3 40 c6 10 80       	mov    %eax,0x8010c640
80102fc7:	84 d2                	test   %dl,%dl
80102fc9:	74 13                	je     80102fde <cpunum+0x3d>
      cprintf("cpu called from %x with interrupts enabled\n",
80102fcb:	8b 45 04             	mov    0x4(%ebp),%eax
80102fce:	89 44 24 04          	mov    %eax,0x4(%esp)
80102fd2:	c7 04 24 c0 8a 10 80 	movl   $0x80108ac0,(%esp)
80102fd9:	e8 c3 d3 ff ff       	call   801003a1 <cprintf>
        __builtin_return_address(0));
  }

  if(lapic)
80102fde:	a1 80 08 11 80       	mov    0x80110880,%eax
80102fe3:	85 c0                	test   %eax,%eax
80102fe5:	74 0f                	je     80102ff6 <cpunum+0x55>
    return lapic[ID]>>24;
80102fe7:	a1 80 08 11 80       	mov    0x80110880,%eax
80102fec:	83 c0 20             	add    $0x20,%eax
80102fef:	8b 00                	mov    (%eax),%eax
80102ff1:	c1 e8 18             	shr    $0x18,%eax
80102ff4:	eb 05                	jmp    80102ffb <cpunum+0x5a>
  return 0;
80102ff6:	b8 00 00 00 00       	mov    $0x0,%eax
}
80102ffb:	c9                   	leave  
80102ffc:	c3                   	ret    

80102ffd <lapiceoi>:

// Acknowledge interrupt.
void
lapiceoi(void)
{
80102ffd:	55                   	push   %ebp
80102ffe:	89 e5                	mov    %esp,%ebp
80103000:	83 ec 08             	sub    $0x8,%esp
  if(lapic)
80103003:	a1 80 08 11 80       	mov    0x80110880,%eax
80103008:	85 c0                	test   %eax,%eax
8010300a:	74 14                	je     80103020 <lapiceoi+0x23>
    lapicw(EOI, 0);
8010300c:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80103013:	00 
80103014:	c7 04 24 2c 00 00 00 	movl   $0x2c,(%esp)
8010301b:	e8 03 fe ff ff       	call   80102e23 <lapicw>
}
80103020:	c9                   	leave  
80103021:	c3                   	ret    

80103022 <microdelay>:

// Spin for a given number of microseconds.
// On real hardware would want to tune this dynamically.
void
microdelay(int us)
{
80103022:	55                   	push   %ebp
80103023:	89 e5                	mov    %esp,%ebp
}
80103025:	5d                   	pop    %ebp
80103026:	c3                   	ret    

80103027 <lapicstartap>:

// Start additional processor running entry code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapicstartap(uchar apicid, uint addr)
{
80103027:	55                   	push   %ebp
80103028:	89 e5                	mov    %esp,%ebp
8010302a:	83 ec 1c             	sub    $0x1c,%esp
8010302d:	8b 45 08             	mov    0x8(%ebp),%eax
80103030:	88 45 ec             	mov    %al,-0x14(%ebp)
  ushort *wrv;
  
  // "The BSP must initialize CMOS shutdown code to 0AH
  // and the warm reset vector (DWORD based at 40:67) to point at
  // the AP startup code prior to the [universal startup algorithm]."
  outb(IO_RTC, 0xF);  // offset 0xF is shutdown code
80103033:	c7 44 24 04 0f 00 00 	movl   $0xf,0x4(%esp)
8010303a:	00 
8010303b:	c7 04 24 70 00 00 00 	movl   $0x70,(%esp)
80103042:	e8 a9 fd ff ff       	call   80102df0 <outb>
  outb(IO_RTC+1, 0x0A);
80103047:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
8010304e:	00 
8010304f:	c7 04 24 71 00 00 00 	movl   $0x71,(%esp)
80103056:	e8 95 fd ff ff       	call   80102df0 <outb>
  wrv = (ushort*)P2V((0x40<<4 | 0x67));  // Warm reset vector
8010305b:	c7 45 f8 67 04 00 80 	movl   $0x80000467,-0x8(%ebp)
  wrv[0] = 0;
80103062:	8b 45 f8             	mov    -0x8(%ebp),%eax
80103065:	66 c7 00 00 00       	movw   $0x0,(%eax)
  wrv[1] = addr >> 4;
8010306a:	8b 45 f8             	mov    -0x8(%ebp),%eax
8010306d:	8d 50 02             	lea    0x2(%eax),%edx
80103070:	8b 45 0c             	mov    0xc(%ebp),%eax
80103073:	c1 e8 04             	shr    $0x4,%eax
80103076:	66 89 02             	mov    %ax,(%edx)

  // "Universal startup algorithm."
  // Send INIT (level-triggered) interrupt to reset other CPU.
  lapicw(ICRHI, apicid<<24);
80103079:	0f b6 45 ec          	movzbl -0x14(%ebp),%eax
8010307d:	c1 e0 18             	shl    $0x18,%eax
80103080:	89 44 24 04          	mov    %eax,0x4(%esp)
80103084:	c7 04 24 c4 00 00 00 	movl   $0xc4,(%esp)
8010308b:	e8 93 fd ff ff       	call   80102e23 <lapicw>
  lapicw(ICRLO, INIT | LEVEL | ASSERT);
80103090:	c7 44 24 04 00 c5 00 	movl   $0xc500,0x4(%esp)
80103097:	00 
80103098:	c7 04 24 c0 00 00 00 	movl   $0xc0,(%esp)
8010309f:	e8 7f fd ff ff       	call   80102e23 <lapicw>
  microdelay(200);
801030a4:	c7 04 24 c8 00 00 00 	movl   $0xc8,(%esp)
801030ab:	e8 72 ff ff ff       	call   80103022 <microdelay>
  lapicw(ICRLO, INIT | LEVEL);
801030b0:	c7 44 24 04 00 85 00 	movl   $0x8500,0x4(%esp)
801030b7:	00 
801030b8:	c7 04 24 c0 00 00 00 	movl   $0xc0,(%esp)
801030bf:	e8 5f fd ff ff       	call   80102e23 <lapicw>
  microdelay(100);    // should be 10ms, but too slow in Bochs!
801030c4:	c7 04 24 64 00 00 00 	movl   $0x64,(%esp)
801030cb:	e8 52 ff ff ff       	call   80103022 <microdelay>
  // Send startup IPI (twice!) to enter code.
  // Regular hardware is supposed to only accept a STARTUP
  // when it is in the halted state due to an INIT.  So the second
  // should be ignored, but it is part of the official Intel algorithm.
  // Bochs complains about the second one.  Too bad for Bochs.
  for(i = 0; i < 2; i++){
801030d0:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
801030d7:	eb 40                	jmp    80103119 <lapicstartap+0xf2>
    lapicw(ICRHI, apicid<<24);
801030d9:	0f b6 45 ec          	movzbl -0x14(%ebp),%eax
801030dd:	c1 e0 18             	shl    $0x18,%eax
801030e0:	89 44 24 04          	mov    %eax,0x4(%esp)
801030e4:	c7 04 24 c4 00 00 00 	movl   $0xc4,(%esp)
801030eb:	e8 33 fd ff ff       	call   80102e23 <lapicw>
    lapicw(ICRLO, STARTUP | (addr>>12));
801030f0:	8b 45 0c             	mov    0xc(%ebp),%eax
801030f3:	c1 e8 0c             	shr    $0xc,%eax
801030f6:	80 cc 06             	or     $0x6,%ah
801030f9:	89 44 24 04          	mov    %eax,0x4(%esp)
801030fd:	c7 04 24 c0 00 00 00 	movl   $0xc0,(%esp)
80103104:	e8 1a fd ff ff       	call   80102e23 <lapicw>
    microdelay(200);
80103109:	c7 04 24 c8 00 00 00 	movl   $0xc8,(%esp)
80103110:	e8 0d ff ff ff       	call   80103022 <microdelay>
  // Send startup IPI (twice!) to enter code.
  // Regular hardware is supposed to only accept a STARTUP
  // when it is in the halted state due to an INIT.  So the second
  // should be ignored, but it is part of the official Intel algorithm.
  // Bochs complains about the second one.  Too bad for Bochs.
  for(i = 0; i < 2; i++){
80103115:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80103119:	83 7d fc 01          	cmpl   $0x1,-0x4(%ebp)
8010311d:	7e ba                	jle    801030d9 <lapicstartap+0xb2>
    lapicw(ICRHI, apicid<<24);
    lapicw(ICRLO, STARTUP | (addr>>12));
    microdelay(200);
  }
}
8010311f:	c9                   	leave  
80103120:	c3                   	ret    
80103121:	00 00                	add    %al,(%eax)
	...

80103124 <initlog>:

static void recover_from_log(void);

void
initlog(void)
{
80103124:	55                   	push   %ebp
80103125:	89 e5                	mov    %esp,%ebp
80103127:	83 ec 28             	sub    $0x28,%esp
  if (sizeof(struct logheader) >= BSIZE)
    panic("initlog: too big logheader");

  struct superblock sb;
  initlock(&log.lock, "log");
8010312a:	c7 44 24 04 ec 8a 10 	movl   $0x80108aec,0x4(%esp)
80103131:	80 
80103132:	c7 04 24 a0 08 11 80 	movl   $0x801108a0,(%esp)
80103139:	e8 ec 1a 00 00       	call   80104c2a <initlock>
  readsb(ROOTDEV, &sb);
8010313e:	8d 45 e8             	lea    -0x18(%ebp),%eax
80103141:	89 44 24 04          	mov    %eax,0x4(%esp)
80103145:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
8010314c:	e8 ab e1 ff ff       	call   801012fc <readsb>
  log.start = sb.size - sb.nlog;
80103151:	8b 55 e8             	mov    -0x18(%ebp),%edx
80103154:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103157:	89 d1                	mov    %edx,%ecx
80103159:	29 c1                	sub    %eax,%ecx
8010315b:	89 c8                	mov    %ecx,%eax
8010315d:	a3 d4 08 11 80       	mov    %eax,0x801108d4
  log.size = sb.nlog;
80103162:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103165:	a3 d8 08 11 80       	mov    %eax,0x801108d8
  log.dev = ROOTDEV;
8010316a:	c7 05 e0 08 11 80 01 	movl   $0x1,0x801108e0
80103171:	00 00 00 
  recover_from_log();
80103174:	e8 97 01 00 00       	call   80103310 <recover_from_log>
}
80103179:	c9                   	leave  
8010317a:	c3                   	ret    

8010317b <install_trans>:

// Copy committed blocks from log to their home location
static void 
install_trans(void)
{
8010317b:	55                   	push   %ebp
8010317c:	89 e5                	mov    %esp,%ebp
8010317e:	83 ec 28             	sub    $0x28,%esp
  int tail;

  for (tail = 0; tail < log.lh.n; tail++) {
80103181:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80103188:	e9 89 00 00 00       	jmp    80103216 <install_trans+0x9b>
    struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
8010318d:	a1 d4 08 11 80       	mov    0x801108d4,%eax
80103192:	03 45 f4             	add    -0xc(%ebp),%eax
80103195:	83 c0 01             	add    $0x1,%eax
80103198:	89 c2                	mov    %eax,%edx
8010319a:	a1 e0 08 11 80       	mov    0x801108e0,%eax
8010319f:	89 54 24 04          	mov    %edx,0x4(%esp)
801031a3:	89 04 24             	mov    %eax,(%esp)
801031a6:	e8 fb cf ff ff       	call   801001a6 <bread>
801031ab:	89 45 f0             	mov    %eax,-0x10(%ebp)
    struct buf *dbuf = bread(log.dev, log.lh.sector[tail]); // read dst
801031ae:	8b 45 f4             	mov    -0xc(%ebp),%eax
801031b1:	83 c0 10             	add    $0x10,%eax
801031b4:	8b 04 85 a8 08 11 80 	mov    -0x7feef758(,%eax,4),%eax
801031bb:	89 c2                	mov    %eax,%edx
801031bd:	a1 e0 08 11 80       	mov    0x801108e0,%eax
801031c2:	89 54 24 04          	mov    %edx,0x4(%esp)
801031c6:	89 04 24             	mov    %eax,(%esp)
801031c9:	e8 d8 cf ff ff       	call   801001a6 <bread>
801031ce:	89 45 ec             	mov    %eax,-0x14(%ebp)
    memmove(dbuf->data, lbuf->data, BSIZE);  // copy block to dst
801031d1:	8b 45 f0             	mov    -0x10(%ebp),%eax
801031d4:	8d 50 18             	lea    0x18(%eax),%edx
801031d7:	8b 45 ec             	mov    -0x14(%ebp),%eax
801031da:	83 c0 18             	add    $0x18,%eax
801031dd:	c7 44 24 08 00 02 00 	movl   $0x200,0x8(%esp)
801031e4:	00 
801031e5:	89 54 24 04          	mov    %edx,0x4(%esp)
801031e9:	89 04 24             	mov    %eax,(%esp)
801031ec:	e8 7c 1d 00 00       	call   80104f6d <memmove>
    bwrite(dbuf);  // write dst to disk
801031f1:	8b 45 ec             	mov    -0x14(%ebp),%eax
801031f4:	89 04 24             	mov    %eax,(%esp)
801031f7:	e8 e1 cf ff ff       	call   801001dd <bwrite>
    brelse(lbuf); 
801031fc:	8b 45 f0             	mov    -0x10(%ebp),%eax
801031ff:	89 04 24             	mov    %eax,(%esp)
80103202:	e8 10 d0 ff ff       	call   80100217 <brelse>
    brelse(dbuf);
80103207:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010320a:	89 04 24             	mov    %eax,(%esp)
8010320d:	e8 05 d0 ff ff       	call   80100217 <brelse>
static void 
install_trans(void)
{
  int tail;

  for (tail = 0; tail < log.lh.n; tail++) {
80103212:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80103216:	a1 e4 08 11 80       	mov    0x801108e4,%eax
8010321b:	3b 45 f4             	cmp    -0xc(%ebp),%eax
8010321e:	0f 8f 69 ff ff ff    	jg     8010318d <install_trans+0x12>
    memmove(dbuf->data, lbuf->data, BSIZE);  // copy block to dst
    bwrite(dbuf);  // write dst to disk
    brelse(lbuf); 
    brelse(dbuf);
  }
}
80103224:	c9                   	leave  
80103225:	c3                   	ret    

80103226 <read_head>:

// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
80103226:	55                   	push   %ebp
80103227:	89 e5                	mov    %esp,%ebp
80103229:	83 ec 28             	sub    $0x28,%esp
  struct buf *buf = bread(log.dev, log.start);
8010322c:	a1 d4 08 11 80       	mov    0x801108d4,%eax
80103231:	89 c2                	mov    %eax,%edx
80103233:	a1 e0 08 11 80       	mov    0x801108e0,%eax
80103238:	89 54 24 04          	mov    %edx,0x4(%esp)
8010323c:	89 04 24             	mov    %eax,(%esp)
8010323f:	e8 62 cf ff ff       	call   801001a6 <bread>
80103244:	89 45 f0             	mov    %eax,-0x10(%ebp)
  struct logheader *lh = (struct logheader *) (buf->data);
80103247:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010324a:	83 c0 18             	add    $0x18,%eax
8010324d:	89 45 ec             	mov    %eax,-0x14(%ebp)
  int i;
  log.lh.n = lh->n;
80103250:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103253:	8b 00                	mov    (%eax),%eax
80103255:	a3 e4 08 11 80       	mov    %eax,0x801108e4
  for (i = 0; i < log.lh.n; i++) {
8010325a:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80103261:	eb 1b                	jmp    8010327e <read_head+0x58>
    log.lh.sector[i] = lh->sector[i];
80103263:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103266:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103269:	8b 44 90 04          	mov    0x4(%eax,%edx,4),%eax
8010326d:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103270:	83 c2 10             	add    $0x10,%edx
80103273:	89 04 95 a8 08 11 80 	mov    %eax,-0x7feef758(,%edx,4)
{
  struct buf *buf = bread(log.dev, log.start);
  struct logheader *lh = (struct logheader *) (buf->data);
  int i;
  log.lh.n = lh->n;
  for (i = 0; i < log.lh.n; i++) {
8010327a:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010327e:	a1 e4 08 11 80       	mov    0x801108e4,%eax
80103283:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80103286:	7f db                	jg     80103263 <read_head+0x3d>
    log.lh.sector[i] = lh->sector[i];
  }
  brelse(buf);
80103288:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010328b:	89 04 24             	mov    %eax,(%esp)
8010328e:	e8 84 cf ff ff       	call   80100217 <brelse>
}
80103293:	c9                   	leave  
80103294:	c3                   	ret    

80103295 <write_head>:
// Write in-memory log header to disk.
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
80103295:	55                   	push   %ebp
80103296:	89 e5                	mov    %esp,%ebp
80103298:	83 ec 28             	sub    $0x28,%esp
  struct buf *buf = bread(log.dev, log.start);
8010329b:	a1 d4 08 11 80       	mov    0x801108d4,%eax
801032a0:	89 c2                	mov    %eax,%edx
801032a2:	a1 e0 08 11 80       	mov    0x801108e0,%eax
801032a7:	89 54 24 04          	mov    %edx,0x4(%esp)
801032ab:	89 04 24             	mov    %eax,(%esp)
801032ae:	e8 f3 ce ff ff       	call   801001a6 <bread>
801032b3:	89 45 f0             	mov    %eax,-0x10(%ebp)
  struct logheader *hb = (struct logheader *) (buf->data);
801032b6:	8b 45 f0             	mov    -0x10(%ebp),%eax
801032b9:	83 c0 18             	add    $0x18,%eax
801032bc:	89 45 ec             	mov    %eax,-0x14(%ebp)
  int i;
  hb->n = log.lh.n;
801032bf:	8b 15 e4 08 11 80    	mov    0x801108e4,%edx
801032c5:	8b 45 ec             	mov    -0x14(%ebp),%eax
801032c8:	89 10                	mov    %edx,(%eax)
  for (i = 0; i < log.lh.n; i++) {
801032ca:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801032d1:	eb 1b                	jmp    801032ee <write_head+0x59>
    hb->sector[i] = log.lh.sector[i];
801032d3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801032d6:	83 c0 10             	add    $0x10,%eax
801032d9:	8b 0c 85 a8 08 11 80 	mov    -0x7feef758(,%eax,4),%ecx
801032e0:	8b 45 ec             	mov    -0x14(%ebp),%eax
801032e3:	8b 55 f4             	mov    -0xc(%ebp),%edx
801032e6:	89 4c 90 04          	mov    %ecx,0x4(%eax,%edx,4)
{
  struct buf *buf = bread(log.dev, log.start);
  struct logheader *hb = (struct logheader *) (buf->data);
  int i;
  hb->n = log.lh.n;
  for (i = 0; i < log.lh.n; i++) {
801032ea:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801032ee:	a1 e4 08 11 80       	mov    0x801108e4,%eax
801032f3:	3b 45 f4             	cmp    -0xc(%ebp),%eax
801032f6:	7f db                	jg     801032d3 <write_head+0x3e>
    hb->sector[i] = log.lh.sector[i];
  }
  bwrite(buf);
801032f8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801032fb:	89 04 24             	mov    %eax,(%esp)
801032fe:	e8 da ce ff ff       	call   801001dd <bwrite>
  brelse(buf);
80103303:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103306:	89 04 24             	mov    %eax,(%esp)
80103309:	e8 09 cf ff ff       	call   80100217 <brelse>
}
8010330e:	c9                   	leave  
8010330f:	c3                   	ret    

80103310 <recover_from_log>:

static void
recover_from_log(void)
{
80103310:	55                   	push   %ebp
80103311:	89 e5                	mov    %esp,%ebp
80103313:	83 ec 08             	sub    $0x8,%esp
  read_head();      
80103316:	e8 0b ff ff ff       	call   80103226 <read_head>
  install_trans(); // if committed, copy from log to disk
8010331b:	e8 5b fe ff ff       	call   8010317b <install_trans>
  log.lh.n = 0;
80103320:	c7 05 e4 08 11 80 00 	movl   $0x0,0x801108e4
80103327:	00 00 00 
  write_head(); // clear the log
8010332a:	e8 66 ff ff ff       	call   80103295 <write_head>
}
8010332f:	c9                   	leave  
80103330:	c3                   	ret    

80103331 <begin_trans>:

void
begin_trans(void)
{
80103331:	55                   	push   %ebp
80103332:	89 e5                	mov    %esp,%ebp
80103334:	83 ec 18             	sub    $0x18,%esp
  acquire(&log.lock);
80103337:	c7 04 24 a0 08 11 80 	movl   $0x801108a0,(%esp)
8010333e:	e8 08 19 00 00       	call   80104c4b <acquire>
  while (log.busy) {
80103343:	eb 14                	jmp    80103359 <begin_trans+0x28>
    sleep(&log, &log.lock);
80103345:	c7 44 24 04 a0 08 11 	movl   $0x801108a0,0x4(%esp)
8010334c:	80 
8010334d:	c7 04 24 a0 08 11 80 	movl   $0x801108a0,(%esp)
80103354:	e8 30 16 00 00       	call   80104989 <sleep>

void
begin_trans(void)
{
  acquire(&log.lock);
  while (log.busy) {
80103359:	a1 dc 08 11 80       	mov    0x801108dc,%eax
8010335e:	85 c0                	test   %eax,%eax
80103360:	75 e3                	jne    80103345 <begin_trans+0x14>
    sleep(&log, &log.lock);
  }
  log.busy = 1;
80103362:	c7 05 dc 08 11 80 01 	movl   $0x1,0x801108dc
80103369:	00 00 00 
  release(&log.lock);
8010336c:	c7 04 24 a0 08 11 80 	movl   $0x801108a0,(%esp)
80103373:	e8 35 19 00 00       	call   80104cad <release>
}
80103378:	c9                   	leave  
80103379:	c3                   	ret    

8010337a <commit_trans>:

void
commit_trans(void)
{
8010337a:	55                   	push   %ebp
8010337b:	89 e5                	mov    %esp,%ebp
8010337d:	83 ec 18             	sub    $0x18,%esp
  if (log.lh.n > 0) {
80103380:	a1 e4 08 11 80       	mov    0x801108e4,%eax
80103385:	85 c0                	test   %eax,%eax
80103387:	7e 19                	jle    801033a2 <commit_trans+0x28>
    write_head();    // Write header to disk -- the real commit
80103389:	e8 07 ff ff ff       	call   80103295 <write_head>
    install_trans(); // Now install writes to home locations
8010338e:	e8 e8 fd ff ff       	call   8010317b <install_trans>
    log.lh.n = 0; 
80103393:	c7 05 e4 08 11 80 00 	movl   $0x0,0x801108e4
8010339a:	00 00 00 
    write_head();    // Erase the transaction from the log
8010339d:	e8 f3 fe ff ff       	call   80103295 <write_head>
  }
  
  acquire(&log.lock);
801033a2:	c7 04 24 a0 08 11 80 	movl   $0x801108a0,(%esp)
801033a9:	e8 9d 18 00 00       	call   80104c4b <acquire>
  log.busy = 0;
801033ae:	c7 05 dc 08 11 80 00 	movl   $0x0,0x801108dc
801033b5:	00 00 00 
  wakeup(&log);
801033b8:	c7 04 24 a0 08 11 80 	movl   $0x801108a0,(%esp)
801033bf:	e8 9e 16 00 00       	call   80104a62 <wakeup>
  release(&log.lock);
801033c4:	c7 04 24 a0 08 11 80 	movl   $0x801108a0,(%esp)
801033cb:	e8 dd 18 00 00       	call   80104cad <release>
}
801033d0:	c9                   	leave  
801033d1:	c3                   	ret    

801033d2 <log_write>:
//   modify bp->data[]
//   log_write(bp)
//   brelse(bp)
void
log_write(struct buf *b)
{
801033d2:	55                   	push   %ebp
801033d3:	89 e5                	mov    %esp,%ebp
801033d5:	83 ec 28             	sub    $0x28,%esp
  int i;

  if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
801033d8:	a1 e4 08 11 80       	mov    0x801108e4,%eax
801033dd:	83 f8 09             	cmp    $0x9,%eax
801033e0:	7f 12                	jg     801033f4 <log_write+0x22>
801033e2:	a1 e4 08 11 80       	mov    0x801108e4,%eax
801033e7:	8b 15 d8 08 11 80    	mov    0x801108d8,%edx
801033ed:	83 ea 01             	sub    $0x1,%edx
801033f0:	39 d0                	cmp    %edx,%eax
801033f2:	7c 0c                	jl     80103400 <log_write+0x2e>
    panic("too big a transaction");
801033f4:	c7 04 24 f0 8a 10 80 	movl   $0x80108af0,(%esp)
801033fb:	e8 55 d1 ff ff       	call   80100555 <panic>
  if (!log.busy)
80103400:	a1 dc 08 11 80       	mov    0x801108dc,%eax
80103405:	85 c0                	test   %eax,%eax
80103407:	75 0c                	jne    80103415 <log_write+0x43>
    panic("write outside of trans");
80103409:	c7 04 24 06 8b 10 80 	movl   $0x80108b06,(%esp)
80103410:	e8 40 d1 ff ff       	call   80100555 <panic>

  for (i = 0; i < log.lh.n; i++) {
80103415:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010341c:	eb 1d                	jmp    8010343b <log_write+0x69>
    if (log.lh.sector[i] == b->sector)   // log absorbtion?
8010341e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103421:	83 c0 10             	add    $0x10,%eax
80103424:	8b 04 85 a8 08 11 80 	mov    -0x7feef758(,%eax,4),%eax
8010342b:	89 c2                	mov    %eax,%edx
8010342d:	8b 45 08             	mov    0x8(%ebp),%eax
80103430:	8b 40 08             	mov    0x8(%eax),%eax
80103433:	39 c2                	cmp    %eax,%edx
80103435:	74 10                	je     80103447 <log_write+0x75>
  if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
    panic("too big a transaction");
  if (!log.busy)
    panic("write outside of trans");

  for (i = 0; i < log.lh.n; i++) {
80103437:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010343b:	a1 e4 08 11 80       	mov    0x801108e4,%eax
80103440:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80103443:	7f d9                	jg     8010341e <log_write+0x4c>
80103445:	eb 01                	jmp    80103448 <log_write+0x76>
    if (log.lh.sector[i] == b->sector)   // log absorbtion?
      break;
80103447:	90                   	nop
  }
  log.lh.sector[i] = b->sector;
80103448:	8b 45 08             	mov    0x8(%ebp),%eax
8010344b:	8b 40 08             	mov    0x8(%eax),%eax
8010344e:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103451:	83 c2 10             	add    $0x10,%edx
80103454:	89 04 95 a8 08 11 80 	mov    %eax,-0x7feef758(,%edx,4)
  struct buf *lbuf = bread(b->dev, log.start+i+1);
8010345b:	a1 d4 08 11 80       	mov    0x801108d4,%eax
80103460:	03 45 f4             	add    -0xc(%ebp),%eax
80103463:	83 c0 01             	add    $0x1,%eax
80103466:	89 c2                	mov    %eax,%edx
80103468:	8b 45 08             	mov    0x8(%ebp),%eax
8010346b:	8b 40 04             	mov    0x4(%eax),%eax
8010346e:	89 54 24 04          	mov    %edx,0x4(%esp)
80103472:	89 04 24             	mov    %eax,(%esp)
80103475:	e8 2c cd ff ff       	call   801001a6 <bread>
8010347a:	89 45 f0             	mov    %eax,-0x10(%ebp)
  memmove(lbuf->data, b->data, BSIZE);
8010347d:	8b 45 08             	mov    0x8(%ebp),%eax
80103480:	8d 50 18             	lea    0x18(%eax),%edx
80103483:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103486:	83 c0 18             	add    $0x18,%eax
80103489:	c7 44 24 08 00 02 00 	movl   $0x200,0x8(%esp)
80103490:	00 
80103491:	89 54 24 04          	mov    %edx,0x4(%esp)
80103495:	89 04 24             	mov    %eax,(%esp)
80103498:	e8 d0 1a 00 00       	call   80104f6d <memmove>
  bwrite(lbuf);
8010349d:	8b 45 f0             	mov    -0x10(%ebp),%eax
801034a0:	89 04 24             	mov    %eax,(%esp)
801034a3:	e8 35 cd ff ff       	call   801001dd <bwrite>
  brelse(lbuf);
801034a8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801034ab:	89 04 24             	mov    %eax,(%esp)
801034ae:	e8 64 cd ff ff       	call   80100217 <brelse>
  if (i == log.lh.n)
801034b3:	a1 e4 08 11 80       	mov    0x801108e4,%eax
801034b8:	3b 45 f4             	cmp    -0xc(%ebp),%eax
801034bb:	75 0d                	jne    801034ca <log_write+0xf8>
    log.lh.n++;
801034bd:	a1 e4 08 11 80       	mov    0x801108e4,%eax
801034c2:	83 c0 01             	add    $0x1,%eax
801034c5:	a3 e4 08 11 80       	mov    %eax,0x801108e4
  b->flags |= B_DIRTY; // XXX prevent eviction
801034ca:	8b 45 08             	mov    0x8(%ebp),%eax
801034cd:	8b 00                	mov    (%eax),%eax
801034cf:	89 c2                	mov    %eax,%edx
801034d1:	83 ca 04             	or     $0x4,%edx
801034d4:	8b 45 08             	mov    0x8(%ebp),%eax
801034d7:	89 10                	mov    %edx,(%eax)
}
801034d9:	c9                   	leave  
801034da:	c3                   	ret    
	...

801034dc <v2p>:
801034dc:	55                   	push   %ebp
801034dd:	89 e5                	mov    %esp,%ebp
801034df:	8b 45 08             	mov    0x8(%ebp),%eax
801034e2:	05 00 00 00 80       	add    $0x80000000,%eax
801034e7:	5d                   	pop    %ebp
801034e8:	c3                   	ret    

801034e9 <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
801034e9:	55                   	push   %ebp
801034ea:	89 e5                	mov    %esp,%ebp
801034ec:	8b 45 08             	mov    0x8(%ebp),%eax
801034ef:	05 00 00 00 80       	add    $0x80000000,%eax
801034f4:	5d                   	pop    %ebp
801034f5:	c3                   	ret    

801034f6 <xchg>:
  asm volatile("sti");
}

static inline uint
xchg(volatile uint *addr, uint newval)
{
801034f6:	55                   	push   %ebp
801034f7:	89 e5                	mov    %esp,%ebp
801034f9:	53                   	push   %ebx
801034fa:	83 ec 10             	sub    $0x10,%esp
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
               "+m" (*addr), "=a" (result) :
801034fd:	8b 55 08             	mov    0x8(%ebp),%edx
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
80103500:	8b 45 0c             	mov    0xc(%ebp),%eax
               "+m" (*addr), "=a" (result) :
80103503:	8b 4d 08             	mov    0x8(%ebp),%ecx
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
80103506:	89 c3                	mov    %eax,%ebx
80103508:	89 d8                	mov    %ebx,%eax
8010350a:	f0 87 02             	lock xchg %eax,(%edx)
8010350d:	89 c3                	mov    %eax,%ebx
8010350f:	89 5d f8             	mov    %ebx,-0x8(%ebp)
               "+m" (*addr), "=a" (result) :
               "1" (newval) :
               "cc");
  return result;
80103512:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80103515:	83 c4 10             	add    $0x10,%esp
80103518:	5b                   	pop    %ebx
80103519:	5d                   	pop    %ebp
8010351a:	c3                   	ret    

8010351b <main>:
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
8010351b:	55                   	push   %ebp
8010351c:	89 e5                	mov    %esp,%ebp
8010351e:	83 e4 f0             	and    $0xfffffff0,%esp
80103521:	83 ec 10             	sub    $0x10,%esp
  kinit1(end, P2V(4*1024*1024)); // phys page allocator
80103524:	c7 44 24 04 00 00 40 	movl   $0x80400000,0x4(%esp)
8010352b:	80 
8010352c:	c7 04 24 20 37 11 80 	movl   $0x80113720,(%esp)
80103533:	e8 a9 f4 ff ff       	call   801029e1 <kinit1>
  kvmalloc();      // kernel page table
80103538:	e8 31 46 00 00       	call   80107b6e <kvmalloc>
  mpinit();        // collect info about this machine
8010353d:	e8 8f 04 00 00       	call   801039d1 <mpinit>
  lapicinit();
80103542:	e8 fd f8 ff ff       	call   80102e44 <lapicinit>
  seginit();       // set up segments
80103547:	e8 d1 3e 00 00       	call   8010741d <seginit>

  picinit();       // interrupt controller
8010354c:	e8 e5 06 00 00       	call   80103c36 <picinit>
  ioapicinit();    // another interrupt controller
80103551:	e8 7b f3 ff ff       	call   801028d1 <ioapicinit>
  consoleinit();   // I/O devices & their interrupts
80103556:	e8 4a d5 ff ff       	call   80100aa5 <consoleinit>
  uartinit();      // serial port
8010355b:	e8 08 32 00 00       	call   80106768 <uartinit>
  pinit();         // process table
80103560:	e8 e6 0b 00 00       	call   8010414b <pinit>
  tvinit();        // trap vectors
80103565:	e8 a1 2d 00 00       	call   8010630b <tvinit>
  binit();         // buffer cache
8010356a:	e8 c5 ca ff ff       	call   80100034 <binit>
  fileinit();      // file table
8010356f:	e8 9c d9 ff ff       	call   80100f10 <fileinit>
  iinit();         // inode cache
80103574:	e8 4a e0 ff ff       	call   801015c3 <iinit>
  ideinit();       // disk
80103579:	e8 b8 ef ff ff       	call   80102536 <ideinit>
  if(!ismp)
8010357e:	a1 24 09 11 80       	mov    0x80110924,%eax
80103583:	85 c0                	test   %eax,%eax
80103585:	75 05                	jne    8010358c <main+0x71>
    timerinit();   // uniprocessor timer
80103587:	e8 c2 2c 00 00       	call   8010624e <timerinit>
  startothers();   // start other processors
8010358c:	e8 d8 00 00 00       	call   80103669 <startothers>
  kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
80103591:	c7 44 24 04 00 00 00 	movl   $0x8e000000,0x4(%esp)
80103598:	8e 
80103599:	c7 04 24 00 00 40 80 	movl   $0x80400000,(%esp)
801035a0:	e8 7e f4 ff ff       	call   80102a23 <kinit2>
  userinit();      // first user process
801035a5:	e8 bc 0c 00 00       	call   80104266 <userinit>

  // Finish setting up this processor in mpmain.
  mpmain();
801035aa:	e8 1a 00 00 00       	call   801035c9 <mpmain>

801035af <mpenter>:
}

// Other CPUs jump here from entryother.S.
static void
mpenter(void)
{
801035af:	55                   	push   %ebp
801035b0:	89 e5                	mov    %esp,%ebp
801035b2:	83 ec 08             	sub    $0x8,%esp
  switchkvm();
801035b5:	e8 cb 45 00 00       	call   80107b85 <switchkvm>
  seginit();
801035ba:	e8 5e 3e 00 00       	call   8010741d <seginit>
  lapicinit();
801035bf:	e8 80 f8 ff ff       	call   80102e44 <lapicinit>
  mpmain();
801035c4:	e8 00 00 00 00       	call   801035c9 <mpmain>

801035c9 <mpmain>:
}

// Common CPU setup code.
static void
mpmain(void)
{
801035c9:	55                   	push   %ebp
801035ca:	89 e5                	mov    %esp,%ebp
801035cc:	83 ec 18             	sub    $0x18,%esp
  cprintf("[kinit1]\tvstart=%x\tvend=%x\n", end, P2V(4*1024*1024));
801035cf:	c7 44 24 08 00 00 40 	movl   $0x80400000,0x8(%esp)
801035d6:	80 
801035d7:	c7 44 24 04 20 37 11 	movl   $0x80113720,0x4(%esp)
801035de:	80 
801035df:	c7 04 24 1d 8b 10 80 	movl   $0x80108b1d,(%esp)
801035e6:	e8 b6 cd ff ff       	call   801003a1 <cprintf>
  cprintf("[kvmalloc]\tkpgdir=%x\n",kpgdir);
801035eb:	a1 18 37 11 80       	mov    0x80113718,%eax
801035f0:	89 44 24 04          	mov    %eax,0x4(%esp)
801035f4:	c7 04 24 39 8b 10 80 	movl   $0x80108b39,(%esp)
801035fb:	e8 a1 cd ff ff       	call   801003a1 <cprintf>
  cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
80103600:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80103606:	0f b6 00             	movzbl (%eax),%eax
80103609:	0f b6 c0             	movzbl %al,%eax
8010360c:	89 44 24 04          	mov    %eax,0x4(%esp)
80103610:	c7 04 24 4f 8b 10 80 	movl   $0x80108b4f,(%esp)
80103617:	e8 85 cd ff ff       	call   801003a1 <cprintf>
//  set_debug_switch();
  cprintf("OS debug_switch is start\n");
8010361c:	c7 04 24 66 8b 10 80 	movl   $0x80108b66,(%esp)
80103623:	e8 79 cd ff ff       	call   801003a1 <cprintf>

  cprintf("cpu%d: starting\n", cpu->id);
80103628:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
8010362e:	0f b6 00             	movzbl (%eax),%eax
80103631:	0f b6 c0             	movzbl %al,%eax
80103634:	89 44 24 04          	mov    %eax,0x4(%esp)
80103638:	c7 04 24 80 8b 10 80 	movl   $0x80108b80,(%esp)
8010363f:	e8 5d cd ff ff       	call   801003a1 <cprintf>
  idtinit();       // load idt register
80103644:	e8 36 2e 00 00       	call   8010647f <idtinit>
  xchg(&cpu->started, 1); // tell startothers() we're up
80103649:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
8010364f:	05 a8 00 00 00       	add    $0xa8,%eax
80103654:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
8010365b:	00 
8010365c:	89 04 24             	mov    %eax,(%esp)
8010365f:	e8 92 fe ff ff       	call   801034f6 <xchg>
  scheduler();     // start running processes
80103664:	e8 4c 11 00 00       	call   801047b5 <scheduler>

80103669 <startothers>:
pde_t entrypgdir[];  // For entry.S

// Start the non-boot (AP) processors.
static void
startothers(void)
{
80103669:	55                   	push   %ebp
8010366a:	89 e5                	mov    %esp,%ebp
8010366c:	53                   	push   %ebx
8010366d:	83 ec 24             	sub    $0x24,%esp
  char *stack;

  // Write entry code to unused memory at 0x7000.
  // The linker has placed the image of entryother.S in
  // _binary_entryother_start.
  code = p2v(0x7000);
80103670:	c7 04 24 00 70 00 00 	movl   $0x7000,(%esp)
80103677:	e8 6d fe ff ff       	call   801034e9 <p2v>
8010367c:	89 45 f0             	mov    %eax,-0x10(%ebp)
  memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
8010367f:	b8 8a 00 00 00       	mov    $0x8a,%eax
80103684:	89 44 24 08          	mov    %eax,0x8(%esp)
80103688:	c7 44 24 04 0c c5 10 	movl   $0x8010c50c,0x4(%esp)
8010368f:	80 
80103690:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103693:	89 04 24             	mov    %eax,(%esp)
80103696:	e8 d2 18 00 00       	call   80104f6d <memmove>

  for(c = cpus; c < cpus+ncpu; c++){
8010369b:	c7 45 f4 40 09 11 80 	movl   $0x80110940,-0xc(%ebp)
801036a2:	e9 86 00 00 00       	jmp    8010372d <startothers+0xc4>
    if(c == cpus+cpunum())  // We've started already.
801036a7:	e8 f5 f8 ff ff       	call   80102fa1 <cpunum>
801036ac:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
801036b2:	05 40 09 11 80       	add    $0x80110940,%eax
801036b7:	3b 45 f4             	cmp    -0xc(%ebp),%eax
801036ba:	74 69                	je     80103725 <startothers+0xbc>
      continue;

    // Tell entryother.S what stack to use, where to enter, and what
    // pgdir to use. We cannot use kpgdir yet, because the AP processor
    // is running in low  memory, so we use entrypgdir for the APs too.
    stack = kalloc();
801036bc:	e8 50 f5 ff ff       	call   80102c11 <kalloc>
801036c1:	89 45 ec             	mov    %eax,-0x14(%ebp)
    *(void**)(code-4) = stack + KSTACKSIZE;
801036c4:	8b 45 f0             	mov    -0x10(%ebp),%eax
801036c7:	83 e8 04             	sub    $0x4,%eax
801036ca:	8b 55 ec             	mov    -0x14(%ebp),%edx
801036cd:	81 c2 00 10 00 00    	add    $0x1000,%edx
801036d3:	89 10                	mov    %edx,(%eax)
    *(void**)(code-8) = mpenter;
801036d5:	8b 45 f0             	mov    -0x10(%ebp),%eax
801036d8:	83 e8 08             	sub    $0x8,%eax
801036db:	c7 00 af 35 10 80    	movl   $0x801035af,(%eax)
    *(int**)(code-12) = (void *) v2p(entrypgdir);
801036e1:	8b 45 f0             	mov    -0x10(%ebp),%eax
801036e4:	8d 58 f4             	lea    -0xc(%eax),%ebx
801036e7:	c7 04 24 00 b0 10 80 	movl   $0x8010b000,(%esp)
801036ee:	e8 e9 fd ff ff       	call   801034dc <v2p>
801036f3:	89 03                	mov    %eax,(%ebx)

    lapicstartap(c->id, v2p(code));
801036f5:	8b 45 f0             	mov    -0x10(%ebp),%eax
801036f8:	89 04 24             	mov    %eax,(%esp)
801036fb:	e8 dc fd ff ff       	call   801034dc <v2p>
80103700:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103703:	0f b6 12             	movzbl (%edx),%edx
80103706:	0f b6 d2             	movzbl %dl,%edx
80103709:	89 44 24 04          	mov    %eax,0x4(%esp)
8010370d:	89 14 24             	mov    %edx,(%esp)
80103710:	e8 12 f9 ff ff       	call   80103027 <lapicstartap>

    // wait for cpu to finish mpmain()
    while(c->started == 0)
80103715:	90                   	nop
80103716:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103719:	8b 80 a8 00 00 00    	mov    0xa8(%eax),%eax
8010371f:	85 c0                	test   %eax,%eax
80103721:	74 f3                	je     80103716 <startothers+0xad>
80103723:	eb 01                	jmp    80103726 <startothers+0xbd>
  code = p2v(0x7000);
  memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);

  for(c = cpus; c < cpus+ncpu; c++){
    if(c == cpus+cpunum())  // We've started already.
      continue;
80103725:	90                   	nop
  // The linker has placed the image of entryother.S in
  // _binary_entryother_start.
  code = p2v(0x7000);
  memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);

  for(c = cpus; c < cpus+ncpu; c++){
80103726:	81 45 f4 bc 00 00 00 	addl   $0xbc,-0xc(%ebp)
8010372d:	a1 20 0f 11 80       	mov    0x80110f20,%eax
80103732:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
80103738:	05 40 09 11 80       	add    $0x80110940,%eax
8010373d:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80103740:	0f 87 61 ff ff ff    	ja     801036a7 <startothers+0x3e>

    // wait for cpu to finish mpmain()
    while(c->started == 0)
      ;
  }
}
80103746:	83 c4 24             	add    $0x24,%esp
80103749:	5b                   	pop    %ebx
8010374a:	5d                   	pop    %ebp
8010374b:	c3                   	ret    

8010374c <p2v>:
8010374c:	55                   	push   %ebp
8010374d:	89 e5                	mov    %esp,%ebp
8010374f:	8b 45 08             	mov    0x8(%ebp),%eax
80103752:	05 00 00 00 80       	add    $0x80000000,%eax
80103757:	5d                   	pop    %ebp
80103758:	c3                   	ret    

80103759 <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
80103759:	55                   	push   %ebp
8010375a:	89 e5                	mov    %esp,%ebp
8010375c:	53                   	push   %ebx
8010375d:	83 ec 14             	sub    $0x14,%esp
80103760:	8b 45 08             	mov    0x8(%ebp),%eax
80103763:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80103767:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
8010376b:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
8010376f:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
80103773:	ec                   	in     (%dx),%al
80103774:	89 c3                	mov    %eax,%ebx
80103776:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
80103779:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
8010377d:	83 c4 14             	add    $0x14,%esp
80103780:	5b                   	pop    %ebx
80103781:	5d                   	pop    %ebp
80103782:	c3                   	ret    

80103783 <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
80103783:	55                   	push   %ebp
80103784:	89 e5                	mov    %esp,%ebp
80103786:	83 ec 08             	sub    $0x8,%esp
80103789:	8b 55 08             	mov    0x8(%ebp),%edx
8010378c:	8b 45 0c             	mov    0xc(%ebp),%eax
8010378f:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
80103793:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80103796:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
8010379a:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
8010379e:	ee                   	out    %al,(%dx)
}
8010379f:	c9                   	leave  
801037a0:	c3                   	ret    

801037a1 <mpbcpu>:
int ncpu;
uchar ioapicid;

int
mpbcpu(void)
{
801037a1:	55                   	push   %ebp
801037a2:	89 e5                	mov    %esp,%ebp
  return bcpu-cpus;
801037a4:	a1 44 c6 10 80       	mov    0x8010c644,%eax
801037a9:	89 c2                	mov    %eax,%edx
801037ab:	b8 40 09 11 80       	mov    $0x80110940,%eax
801037b0:	89 d1                	mov    %edx,%ecx
801037b2:	29 c1                	sub    %eax,%ecx
801037b4:	89 c8                	mov    %ecx,%eax
801037b6:	c1 f8 02             	sar    $0x2,%eax
801037b9:	69 c0 cf 46 7d 67    	imul   $0x677d46cf,%eax,%eax
}
801037bf:	5d                   	pop    %ebp
801037c0:	c3                   	ret    

801037c1 <sum>:

static uchar
sum(uchar *addr, int len)
{
801037c1:	55                   	push   %ebp
801037c2:	89 e5                	mov    %esp,%ebp
801037c4:	83 ec 10             	sub    $0x10,%esp
  int i, sum;
  
  sum = 0;
801037c7:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
  for(i=0; i<len; i++)
801037ce:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
801037d5:	eb 13                	jmp    801037ea <sum+0x29>
    sum += addr[i];
801037d7:	8b 45 fc             	mov    -0x4(%ebp),%eax
801037da:	03 45 08             	add    0x8(%ebp),%eax
801037dd:	0f b6 00             	movzbl (%eax),%eax
801037e0:	0f b6 c0             	movzbl %al,%eax
801037e3:	01 45 f8             	add    %eax,-0x8(%ebp)
sum(uchar *addr, int len)
{
  int i, sum;
  
  sum = 0;
  for(i=0; i<len; i++)
801037e6:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
801037ea:	8b 45 fc             	mov    -0x4(%ebp),%eax
801037ed:	3b 45 0c             	cmp    0xc(%ebp),%eax
801037f0:	7c e5                	jl     801037d7 <sum+0x16>
    sum += addr[i];
  return sum;
801037f2:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
801037f5:	c9                   	leave  
801037f6:	c3                   	ret    

801037f7 <mpsearch1>:

// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
801037f7:	55                   	push   %ebp
801037f8:	89 e5                	mov    %esp,%ebp
801037fa:	83 ec 28             	sub    $0x28,%esp
  uchar *e, *p, *addr;

  addr = p2v(a);
801037fd:	8b 45 08             	mov    0x8(%ebp),%eax
80103800:	89 04 24             	mov    %eax,(%esp)
80103803:	e8 44 ff ff ff       	call   8010374c <p2v>
80103808:	89 45 f0             	mov    %eax,-0x10(%ebp)
  e = addr+len;
8010380b:	8b 45 0c             	mov    0xc(%ebp),%eax
8010380e:	03 45 f0             	add    -0x10(%ebp),%eax
80103811:	89 45 ec             	mov    %eax,-0x14(%ebp)
  for(p = addr; p < e; p += sizeof(struct mp))
80103814:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103817:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010381a:	eb 3f                	jmp    8010385b <mpsearch1+0x64>
    if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
8010381c:	c7 44 24 08 04 00 00 	movl   $0x4,0x8(%esp)
80103823:	00 
80103824:	c7 44 24 04 94 8b 10 	movl   $0x80108b94,0x4(%esp)
8010382b:	80 
8010382c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010382f:	89 04 24             	mov    %eax,(%esp)
80103832:	e8 da 16 00 00       	call   80104f11 <memcmp>
80103837:	85 c0                	test   %eax,%eax
80103839:	75 1c                	jne    80103857 <mpsearch1+0x60>
8010383b:	c7 44 24 04 10 00 00 	movl   $0x10,0x4(%esp)
80103842:	00 
80103843:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103846:	89 04 24             	mov    %eax,(%esp)
80103849:	e8 73 ff ff ff       	call   801037c1 <sum>
8010384e:	84 c0                	test   %al,%al
80103850:	75 05                	jne    80103857 <mpsearch1+0x60>
      return (struct mp*)p;
80103852:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103855:	eb 11                	jmp    80103868 <mpsearch1+0x71>
{
  uchar *e, *p, *addr;

  addr = p2v(a);
  e = addr+len;
  for(p = addr; p < e; p += sizeof(struct mp))
80103857:	83 45 f4 10          	addl   $0x10,-0xc(%ebp)
8010385b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010385e:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80103861:	72 b9                	jb     8010381c <mpsearch1+0x25>
    if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
      return (struct mp*)p;
  return 0;
80103863:	b8 00 00 00 00       	mov    $0x0,%eax
}
80103868:	c9                   	leave  
80103869:	c3                   	ret    

8010386a <mpsearch>:
// 1) in the first KB of the EBDA;
// 2) in the last KB of system base memory;
// 3) in the BIOS ROM between 0xE0000 and 0xFFFFF.
static struct mp*
mpsearch(void)
{
8010386a:	55                   	push   %ebp
8010386b:	89 e5                	mov    %esp,%ebp
8010386d:	83 ec 28             	sub    $0x28,%esp
  uchar *bda;
  uint p;
  struct mp *mp;

  bda = (uchar *) P2V(0x400);
80103870:	c7 45 f4 00 04 00 80 	movl   $0x80000400,-0xc(%ebp)
  if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
80103877:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010387a:	83 c0 0f             	add    $0xf,%eax
8010387d:	0f b6 00             	movzbl (%eax),%eax
80103880:	0f b6 c0             	movzbl %al,%eax
80103883:	89 c2                	mov    %eax,%edx
80103885:	c1 e2 08             	shl    $0x8,%edx
80103888:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010388b:	83 c0 0e             	add    $0xe,%eax
8010388e:	0f b6 00             	movzbl (%eax),%eax
80103891:	0f b6 c0             	movzbl %al,%eax
80103894:	09 d0                	or     %edx,%eax
80103896:	c1 e0 04             	shl    $0x4,%eax
80103899:	89 45 f0             	mov    %eax,-0x10(%ebp)
8010389c:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801038a0:	74 21                	je     801038c3 <mpsearch+0x59>
    if((mp = mpsearch1(p, 1024)))
801038a2:	c7 44 24 04 00 04 00 	movl   $0x400,0x4(%esp)
801038a9:	00 
801038aa:	8b 45 f0             	mov    -0x10(%ebp),%eax
801038ad:	89 04 24             	mov    %eax,(%esp)
801038b0:	e8 42 ff ff ff       	call   801037f7 <mpsearch1>
801038b5:	89 45 ec             	mov    %eax,-0x14(%ebp)
801038b8:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
801038bc:	74 50                	je     8010390e <mpsearch+0xa4>
      return mp;
801038be:	8b 45 ec             	mov    -0x14(%ebp),%eax
801038c1:	eb 5f                	jmp    80103922 <mpsearch+0xb8>
  } else {
    p = ((bda[0x14]<<8)|bda[0x13])*1024;
801038c3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801038c6:	83 c0 14             	add    $0x14,%eax
801038c9:	0f b6 00             	movzbl (%eax),%eax
801038cc:	0f b6 c0             	movzbl %al,%eax
801038cf:	89 c2                	mov    %eax,%edx
801038d1:	c1 e2 08             	shl    $0x8,%edx
801038d4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801038d7:	83 c0 13             	add    $0x13,%eax
801038da:	0f b6 00             	movzbl (%eax),%eax
801038dd:	0f b6 c0             	movzbl %al,%eax
801038e0:	09 d0                	or     %edx,%eax
801038e2:	c1 e0 0a             	shl    $0xa,%eax
801038e5:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if((mp = mpsearch1(p-1024, 1024)))
801038e8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801038eb:	2d 00 04 00 00       	sub    $0x400,%eax
801038f0:	c7 44 24 04 00 04 00 	movl   $0x400,0x4(%esp)
801038f7:	00 
801038f8:	89 04 24             	mov    %eax,(%esp)
801038fb:	e8 f7 fe ff ff       	call   801037f7 <mpsearch1>
80103900:	89 45 ec             	mov    %eax,-0x14(%ebp)
80103903:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80103907:	74 05                	je     8010390e <mpsearch+0xa4>
      return mp;
80103909:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010390c:	eb 14                	jmp    80103922 <mpsearch+0xb8>
  }
  return mpsearch1(0xF0000, 0x10000);
8010390e:	c7 44 24 04 00 00 01 	movl   $0x10000,0x4(%esp)
80103915:	00 
80103916:	c7 04 24 00 00 0f 00 	movl   $0xf0000,(%esp)
8010391d:	e8 d5 fe ff ff       	call   801037f7 <mpsearch1>
}
80103922:	c9                   	leave  
80103923:	c3                   	ret    

80103924 <mpconfig>:
// Check for correct signature, calculate the checksum and,
// if correct, check the version.
// To do: check extended table checksum.
static struct mpconf*
mpconfig(struct mp **pmp)
{
80103924:	55                   	push   %ebp
80103925:	89 e5                	mov    %esp,%ebp
80103927:	83 ec 28             	sub    $0x28,%esp
  struct mpconf *conf;
  struct mp *mp;

  if((mp = mpsearch()) == 0 || mp->physaddr == 0)
8010392a:	e8 3b ff ff ff       	call   8010386a <mpsearch>
8010392f:	89 45 f4             	mov    %eax,-0xc(%ebp)
80103932:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80103936:	74 0a                	je     80103942 <mpconfig+0x1e>
80103938:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010393b:	8b 40 04             	mov    0x4(%eax),%eax
8010393e:	85 c0                	test   %eax,%eax
80103940:	75 0a                	jne    8010394c <mpconfig+0x28>
    return 0;
80103942:	b8 00 00 00 00       	mov    $0x0,%eax
80103947:	e9 83 00 00 00       	jmp    801039cf <mpconfig+0xab>
  conf = (struct mpconf*) p2v((uint) mp->physaddr);
8010394c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010394f:	8b 40 04             	mov    0x4(%eax),%eax
80103952:	89 04 24             	mov    %eax,(%esp)
80103955:	e8 f2 fd ff ff       	call   8010374c <p2v>
8010395a:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(memcmp(conf, "PCMP", 4) != 0)
8010395d:	c7 44 24 08 04 00 00 	movl   $0x4,0x8(%esp)
80103964:	00 
80103965:	c7 44 24 04 99 8b 10 	movl   $0x80108b99,0x4(%esp)
8010396c:	80 
8010396d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103970:	89 04 24             	mov    %eax,(%esp)
80103973:	e8 99 15 00 00       	call   80104f11 <memcmp>
80103978:	85 c0                	test   %eax,%eax
8010397a:	74 07                	je     80103983 <mpconfig+0x5f>
    return 0;
8010397c:	b8 00 00 00 00       	mov    $0x0,%eax
80103981:	eb 4c                	jmp    801039cf <mpconfig+0xab>
  if(conf->version != 1 && conf->version != 4)
80103983:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103986:	0f b6 40 06          	movzbl 0x6(%eax),%eax
8010398a:	3c 01                	cmp    $0x1,%al
8010398c:	74 12                	je     801039a0 <mpconfig+0x7c>
8010398e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103991:	0f b6 40 06          	movzbl 0x6(%eax),%eax
80103995:	3c 04                	cmp    $0x4,%al
80103997:	74 07                	je     801039a0 <mpconfig+0x7c>
    return 0;
80103999:	b8 00 00 00 00       	mov    $0x0,%eax
8010399e:	eb 2f                	jmp    801039cf <mpconfig+0xab>
  if(sum((uchar*)conf, conf->length) != 0)
801039a0:	8b 45 f0             	mov    -0x10(%ebp),%eax
801039a3:	0f b7 40 04          	movzwl 0x4(%eax),%eax
801039a7:	0f b7 c0             	movzwl %ax,%eax
801039aa:	89 44 24 04          	mov    %eax,0x4(%esp)
801039ae:	8b 45 f0             	mov    -0x10(%ebp),%eax
801039b1:	89 04 24             	mov    %eax,(%esp)
801039b4:	e8 08 fe ff ff       	call   801037c1 <sum>
801039b9:	84 c0                	test   %al,%al
801039bb:	74 07                	je     801039c4 <mpconfig+0xa0>
    return 0;
801039bd:	b8 00 00 00 00       	mov    $0x0,%eax
801039c2:	eb 0b                	jmp    801039cf <mpconfig+0xab>
  *pmp = mp;
801039c4:	8b 45 08             	mov    0x8(%ebp),%eax
801039c7:	8b 55 f4             	mov    -0xc(%ebp),%edx
801039ca:	89 10                	mov    %edx,(%eax)
  return conf;
801039cc:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
801039cf:	c9                   	leave  
801039d0:	c3                   	ret    

801039d1 <mpinit>:

void
mpinit(void)
{
801039d1:	55                   	push   %ebp
801039d2:	89 e5                	mov    %esp,%ebp
801039d4:	83 ec 38             	sub    $0x38,%esp
  struct mp *mp;
  struct mpconf *conf;
  struct mpproc *proc;
  struct mpioapic *ioapic;

  bcpu = &cpus[0];
801039d7:	c7 05 44 c6 10 80 40 	movl   $0x80110940,0x8010c644
801039de:	09 11 80 
  if((conf = mpconfig(&mp)) == 0)
801039e1:	8d 45 e0             	lea    -0x20(%ebp),%eax
801039e4:	89 04 24             	mov    %eax,(%esp)
801039e7:	e8 38 ff ff ff       	call   80103924 <mpconfig>
801039ec:	89 45 f0             	mov    %eax,-0x10(%ebp)
801039ef:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801039f3:	0f 84 9c 01 00 00    	je     80103b95 <mpinit+0x1c4>
    return;
  ismp = 1;
801039f9:	c7 05 24 09 11 80 01 	movl   $0x1,0x80110924
80103a00:	00 00 00 
  lapic = (uint*)conf->lapicaddr;
80103a03:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103a06:	8b 40 24             	mov    0x24(%eax),%eax
80103a09:	a3 80 08 11 80       	mov    %eax,0x80110880
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103a0e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103a11:	83 c0 2c             	add    $0x2c,%eax
80103a14:	89 45 f4             	mov    %eax,-0xc(%ebp)
80103a17:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103a1a:	0f b7 40 04          	movzwl 0x4(%eax),%eax
80103a1e:	0f b7 c0             	movzwl %ax,%eax
80103a21:	03 45 f0             	add    -0x10(%ebp),%eax
80103a24:	89 45 ec             	mov    %eax,-0x14(%ebp)
80103a27:	e9 f4 00 00 00       	jmp    80103b20 <mpinit+0x14f>
    switch(*p){
80103a2c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103a2f:	0f b6 00             	movzbl (%eax),%eax
80103a32:	0f b6 c0             	movzbl %al,%eax
80103a35:	83 f8 04             	cmp    $0x4,%eax
80103a38:	0f 87 bf 00 00 00    	ja     80103afd <mpinit+0x12c>
80103a3e:	8b 04 85 dc 8b 10 80 	mov    -0x7fef7424(,%eax,4),%eax
80103a45:	ff e0                	jmp    *%eax
    case MPPROC:
      proc = (struct mpproc*)p;
80103a47:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103a4a:	89 45 e8             	mov    %eax,-0x18(%ebp)
      if(ncpu != proc->apicid){
80103a4d:	8b 45 e8             	mov    -0x18(%ebp),%eax
80103a50:	0f b6 40 01          	movzbl 0x1(%eax),%eax
80103a54:	0f b6 d0             	movzbl %al,%edx
80103a57:	a1 20 0f 11 80       	mov    0x80110f20,%eax
80103a5c:	39 c2                	cmp    %eax,%edx
80103a5e:	74 2d                	je     80103a8d <mpinit+0xbc>
        cprintf("mpinit: ncpu=%d apicid=%d\n", ncpu, proc->apicid);
80103a60:	8b 45 e8             	mov    -0x18(%ebp),%eax
80103a63:	0f b6 40 01          	movzbl 0x1(%eax),%eax
80103a67:	0f b6 d0             	movzbl %al,%edx
80103a6a:	a1 20 0f 11 80       	mov    0x80110f20,%eax
80103a6f:	89 54 24 08          	mov    %edx,0x8(%esp)
80103a73:	89 44 24 04          	mov    %eax,0x4(%esp)
80103a77:	c7 04 24 9e 8b 10 80 	movl   $0x80108b9e,(%esp)
80103a7e:	e8 1e c9 ff ff       	call   801003a1 <cprintf>
        ismp = 0;
80103a83:	c7 05 24 09 11 80 00 	movl   $0x0,0x80110924
80103a8a:	00 00 00 
      }
      if(proc->flags & MPBOOT)
80103a8d:	8b 45 e8             	mov    -0x18(%ebp),%eax
80103a90:	0f b6 40 03          	movzbl 0x3(%eax),%eax
80103a94:	0f b6 c0             	movzbl %al,%eax
80103a97:	83 e0 02             	and    $0x2,%eax
80103a9a:	85 c0                	test   %eax,%eax
80103a9c:	74 15                	je     80103ab3 <mpinit+0xe2>
        bcpu = &cpus[ncpu];
80103a9e:	a1 20 0f 11 80       	mov    0x80110f20,%eax
80103aa3:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
80103aa9:	05 40 09 11 80       	add    $0x80110940,%eax
80103aae:	a3 44 c6 10 80       	mov    %eax,0x8010c644
      cpus[ncpu].id = ncpu;
80103ab3:	8b 15 20 0f 11 80    	mov    0x80110f20,%edx
80103ab9:	a1 20 0f 11 80       	mov    0x80110f20,%eax
80103abe:	69 d2 bc 00 00 00    	imul   $0xbc,%edx,%edx
80103ac4:	81 c2 40 09 11 80    	add    $0x80110940,%edx
80103aca:	88 02                	mov    %al,(%edx)
      ncpu++;
80103acc:	a1 20 0f 11 80       	mov    0x80110f20,%eax
80103ad1:	83 c0 01             	add    $0x1,%eax
80103ad4:	a3 20 0f 11 80       	mov    %eax,0x80110f20
      p += sizeof(struct mpproc);
80103ad9:	83 45 f4 14          	addl   $0x14,-0xc(%ebp)
      continue;
80103add:	eb 41                	jmp    80103b20 <mpinit+0x14f>
    case MPIOAPIC:
      ioapic = (struct mpioapic*)p;
80103adf:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103ae2:	89 45 e4             	mov    %eax,-0x1c(%ebp)
      ioapicid = ioapic->apicno;
80103ae5:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80103ae8:	0f b6 40 01          	movzbl 0x1(%eax),%eax
80103aec:	a2 20 09 11 80       	mov    %al,0x80110920
      p += sizeof(struct mpioapic);
80103af1:	83 45 f4 08          	addl   $0x8,-0xc(%ebp)
      continue;
80103af5:	eb 29                	jmp    80103b20 <mpinit+0x14f>
    case MPBUS:
    case MPIOINTR:
    case MPLINTR:
      p += 8;
80103af7:	83 45 f4 08          	addl   $0x8,-0xc(%ebp)
      continue;
80103afb:	eb 23                	jmp    80103b20 <mpinit+0x14f>
    default:
      cprintf("mpinit: unknown config type %x\n", *p);
80103afd:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103b00:	0f b6 00             	movzbl (%eax),%eax
80103b03:	0f b6 c0             	movzbl %al,%eax
80103b06:	89 44 24 04          	mov    %eax,0x4(%esp)
80103b0a:	c7 04 24 bc 8b 10 80 	movl   $0x80108bbc,(%esp)
80103b11:	e8 8b c8 ff ff       	call   801003a1 <cprintf>
      ismp = 0;
80103b16:	c7 05 24 09 11 80 00 	movl   $0x0,0x80110924
80103b1d:	00 00 00 
  bcpu = &cpus[0];
  if((conf = mpconfig(&mp)) == 0)
    return;
  ismp = 1;
  lapic = (uint*)conf->lapicaddr;
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103b20:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103b23:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80103b26:	0f 82 00 ff ff ff    	jb     80103a2c <mpinit+0x5b>
    default:
      cprintf("mpinit: unknown config type %x\n", *p);
      ismp = 0;
    }
  }
  if(!ismp){
80103b2c:	a1 24 09 11 80       	mov    0x80110924,%eax
80103b31:	85 c0                	test   %eax,%eax
80103b33:	75 1d                	jne    80103b52 <mpinit+0x181>
    // Didn't like what we found; fall back to no MP.
    ncpu = 1;
80103b35:	c7 05 20 0f 11 80 01 	movl   $0x1,0x80110f20
80103b3c:	00 00 00 
    lapic = 0;
80103b3f:	c7 05 80 08 11 80 00 	movl   $0x0,0x80110880
80103b46:	00 00 00 
    ioapicid = 0;
80103b49:	c6 05 20 09 11 80 00 	movb   $0x0,0x80110920
    return;
80103b50:	eb 44                	jmp    80103b96 <mpinit+0x1c5>
  }

  if(mp->imcrp){
80103b52:	8b 45 e0             	mov    -0x20(%ebp),%eax
80103b55:	0f b6 40 0c          	movzbl 0xc(%eax),%eax
80103b59:	84 c0                	test   %al,%al
80103b5b:	74 39                	je     80103b96 <mpinit+0x1c5>
    // Bochs doesn't support IMCR, so this doesn't run on Bochs.
    // But it would on real hardware.
    outb(0x22, 0x70);   // Select IMCR
80103b5d:	c7 44 24 04 70 00 00 	movl   $0x70,0x4(%esp)
80103b64:	00 
80103b65:	c7 04 24 22 00 00 00 	movl   $0x22,(%esp)
80103b6c:	e8 12 fc ff ff       	call   80103783 <outb>
    outb(0x23, inb(0x23) | 1);  // Mask external interrupts.
80103b71:	c7 04 24 23 00 00 00 	movl   $0x23,(%esp)
80103b78:	e8 dc fb ff ff       	call   80103759 <inb>
80103b7d:	83 c8 01             	or     $0x1,%eax
80103b80:	0f b6 c0             	movzbl %al,%eax
80103b83:	89 44 24 04          	mov    %eax,0x4(%esp)
80103b87:	c7 04 24 23 00 00 00 	movl   $0x23,(%esp)
80103b8e:	e8 f0 fb ff ff       	call   80103783 <outb>
80103b93:	eb 01                	jmp    80103b96 <mpinit+0x1c5>
  struct mpproc *proc;
  struct mpioapic *ioapic;

  bcpu = &cpus[0];
  if((conf = mpconfig(&mp)) == 0)
    return;
80103b95:	90                   	nop
    // Bochs doesn't support IMCR, so this doesn't run on Bochs.
    // But it would on real hardware.
    outb(0x22, 0x70);   // Select IMCR
    outb(0x23, inb(0x23) | 1);  // Mask external interrupts.
  }
}
80103b96:	c9                   	leave  
80103b97:	c3                   	ret    

80103b98 <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
80103b98:	55                   	push   %ebp
80103b99:	89 e5                	mov    %esp,%ebp
80103b9b:	83 ec 08             	sub    $0x8,%esp
80103b9e:	8b 55 08             	mov    0x8(%ebp),%edx
80103ba1:	8b 45 0c             	mov    0xc(%ebp),%eax
80103ba4:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
80103ba8:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80103bab:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80103baf:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80103bb3:	ee                   	out    %al,(%dx)
}
80103bb4:	c9                   	leave  
80103bb5:	c3                   	ret    

80103bb6 <picsetmask>:
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE);

static void
picsetmask(ushort mask)
{
80103bb6:	55                   	push   %ebp
80103bb7:	89 e5                	mov    %esp,%ebp
80103bb9:	83 ec 0c             	sub    $0xc,%esp
80103bbc:	8b 45 08             	mov    0x8(%ebp),%eax
80103bbf:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  irqmask = mask;
80103bc3:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
80103bc7:	66 a3 00 c0 10 80    	mov    %ax,0x8010c000
  outb(IO_PIC1+1, mask);
80103bcd:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
80103bd1:	0f b6 c0             	movzbl %al,%eax
80103bd4:	89 44 24 04          	mov    %eax,0x4(%esp)
80103bd8:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103bdf:	e8 b4 ff ff ff       	call   80103b98 <outb>
  outb(IO_PIC2+1, mask >> 8);
80103be4:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
80103be8:	66 c1 e8 08          	shr    $0x8,%ax
80103bec:	0f b6 c0             	movzbl %al,%eax
80103bef:	89 44 24 04          	mov    %eax,0x4(%esp)
80103bf3:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103bfa:	e8 99 ff ff ff       	call   80103b98 <outb>
}
80103bff:	c9                   	leave  
80103c00:	c3                   	ret    

80103c01 <picenable>:

void
picenable(int irq)
{
80103c01:	55                   	push   %ebp
80103c02:	89 e5                	mov    %esp,%ebp
80103c04:	53                   	push   %ebx
80103c05:	83 ec 04             	sub    $0x4,%esp
  picsetmask(irqmask & ~(1<<irq));
80103c08:	8b 45 08             	mov    0x8(%ebp),%eax
80103c0b:	ba 01 00 00 00       	mov    $0x1,%edx
80103c10:	89 d3                	mov    %edx,%ebx
80103c12:	89 c1                	mov    %eax,%ecx
80103c14:	d3 e3                	shl    %cl,%ebx
80103c16:	89 d8                	mov    %ebx,%eax
80103c18:	89 c2                	mov    %eax,%edx
80103c1a:	f7 d2                	not    %edx
80103c1c:	0f b7 05 00 c0 10 80 	movzwl 0x8010c000,%eax
80103c23:	21 d0                	and    %edx,%eax
80103c25:	0f b7 c0             	movzwl %ax,%eax
80103c28:	89 04 24             	mov    %eax,(%esp)
80103c2b:	e8 86 ff ff ff       	call   80103bb6 <picsetmask>
}
80103c30:	83 c4 04             	add    $0x4,%esp
80103c33:	5b                   	pop    %ebx
80103c34:	5d                   	pop    %ebp
80103c35:	c3                   	ret    

80103c36 <picinit>:

// Initialize the 8259A interrupt controllers.
void
picinit(void)
{
80103c36:	55                   	push   %ebp
80103c37:	89 e5                	mov    %esp,%ebp
80103c39:	83 ec 08             	sub    $0x8,%esp
  // mask all interrupts
  outb(IO_PIC1+1, 0xFF);
80103c3c:	c7 44 24 04 ff 00 00 	movl   $0xff,0x4(%esp)
80103c43:	00 
80103c44:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103c4b:	e8 48 ff ff ff       	call   80103b98 <outb>
  outb(IO_PIC2+1, 0xFF);
80103c50:	c7 44 24 04 ff 00 00 	movl   $0xff,0x4(%esp)
80103c57:	00 
80103c58:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103c5f:	e8 34 ff ff ff       	call   80103b98 <outb>

  // ICW1:  0001g0hi
  //    g:  0 = edge triggering, 1 = level triggering
  //    h:  0 = cascaded PICs, 1 = master only
  //    i:  0 = no ICW4, 1 = ICW4 required
  outb(IO_PIC1, 0x11);
80103c64:	c7 44 24 04 11 00 00 	movl   $0x11,0x4(%esp)
80103c6b:	00 
80103c6c:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
80103c73:	e8 20 ff ff ff       	call   80103b98 <outb>

  // ICW2:  Vector offset
  outb(IO_PIC1+1, T_IRQ0);
80103c78:	c7 44 24 04 20 00 00 	movl   $0x20,0x4(%esp)
80103c7f:	00 
80103c80:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103c87:	e8 0c ff ff ff       	call   80103b98 <outb>

  // ICW3:  (master PIC) bit mask of IR lines connected to slaves
  //        (slave PIC) 3-bit # of slave's connection to master
  outb(IO_PIC1+1, 1<<IRQ_SLAVE);
80103c8c:	c7 44 24 04 04 00 00 	movl   $0x4,0x4(%esp)
80103c93:	00 
80103c94:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103c9b:	e8 f8 fe ff ff       	call   80103b98 <outb>
  //    m:  0 = slave PIC, 1 = master PIC
  //      (ignored when b is 0, as the master/slave role
  //      can be hardwired).
  //    a:  1 = Automatic EOI mode
  //    p:  0 = MCS-80/85 mode, 1 = intel x86 mode
  outb(IO_PIC1+1, 0x3);
80103ca0:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
80103ca7:	00 
80103ca8:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103caf:	e8 e4 fe ff ff       	call   80103b98 <outb>

  // Set up slave (8259A-2)
  outb(IO_PIC2, 0x11);                  // ICW1
80103cb4:	c7 44 24 04 11 00 00 	movl   $0x11,0x4(%esp)
80103cbb:	00 
80103cbc:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80103cc3:	e8 d0 fe ff ff       	call   80103b98 <outb>
  outb(IO_PIC2+1, T_IRQ0 + 8);      // ICW2
80103cc8:	c7 44 24 04 28 00 00 	movl   $0x28,0x4(%esp)
80103ccf:	00 
80103cd0:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103cd7:	e8 bc fe ff ff       	call   80103b98 <outb>
  outb(IO_PIC2+1, IRQ_SLAVE);           // ICW3
80103cdc:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
80103ce3:	00 
80103ce4:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103ceb:	e8 a8 fe ff ff       	call   80103b98 <outb>
  // NB Automatic EOI mode doesn't tend to work on the slave.
  // Linux source code says it's "to be investigated".
  outb(IO_PIC2+1, 0x3);                 // ICW4
80103cf0:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
80103cf7:	00 
80103cf8:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103cff:	e8 94 fe ff ff       	call   80103b98 <outb>

  // OCW3:  0ef01prs
  //   ef:  0x = NOP, 10 = clear specific mask, 11 = set specific mask
  //    p:  0 = no polling, 1 = polling mode
  //   rs:  0x = NOP, 10 = read IRR, 11 = read ISR
  outb(IO_PIC1, 0x68);             // clear specific mask
80103d04:	c7 44 24 04 68 00 00 	movl   $0x68,0x4(%esp)
80103d0b:	00 
80103d0c:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
80103d13:	e8 80 fe ff ff       	call   80103b98 <outb>
  outb(IO_PIC1, 0x0a);             // read IRR by default
80103d18:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
80103d1f:	00 
80103d20:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
80103d27:	e8 6c fe ff ff       	call   80103b98 <outb>

  outb(IO_PIC2, 0x68);             // OCW3
80103d2c:	c7 44 24 04 68 00 00 	movl   $0x68,0x4(%esp)
80103d33:	00 
80103d34:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80103d3b:	e8 58 fe ff ff       	call   80103b98 <outb>
  outb(IO_PIC2, 0x0a);             // OCW3
80103d40:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
80103d47:	00 
80103d48:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80103d4f:	e8 44 fe ff ff       	call   80103b98 <outb>

  if(irqmask != 0xFFFF)
80103d54:	0f b7 05 00 c0 10 80 	movzwl 0x8010c000,%eax
80103d5b:	66 83 f8 ff          	cmp    $0xffff,%ax
80103d5f:	74 12                	je     80103d73 <picinit+0x13d>
    picsetmask(irqmask);
80103d61:	0f b7 05 00 c0 10 80 	movzwl 0x8010c000,%eax
80103d68:	0f b7 c0             	movzwl %ax,%eax
80103d6b:	89 04 24             	mov    %eax,(%esp)
80103d6e:	e8 43 fe ff ff       	call   80103bb6 <picsetmask>
}
80103d73:	c9                   	leave  
80103d74:	c3                   	ret    
80103d75:	00 00                	add    %al,(%eax)
	...

80103d78 <pipealloc>:
  int writeopen;  // write fd is still open
};

int
pipealloc(struct file **f0, struct file **f1)
{
80103d78:	55                   	push   %ebp
80103d79:	89 e5                	mov    %esp,%ebp
80103d7b:	83 ec 28             	sub    $0x28,%esp
  struct pipe *p;

  p = 0;
80103d7e:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
  *f0 = *f1 = 0;
80103d85:	8b 45 0c             	mov    0xc(%ebp),%eax
80103d88:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
80103d8e:	8b 45 0c             	mov    0xc(%ebp),%eax
80103d91:	8b 10                	mov    (%eax),%edx
80103d93:	8b 45 08             	mov    0x8(%ebp),%eax
80103d96:	89 10                	mov    %edx,(%eax)
  if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
80103d98:	e8 8f d1 ff ff       	call   80100f2c <filealloc>
80103d9d:	8b 55 08             	mov    0x8(%ebp),%edx
80103da0:	89 02                	mov    %eax,(%edx)
80103da2:	8b 45 08             	mov    0x8(%ebp),%eax
80103da5:	8b 00                	mov    (%eax),%eax
80103da7:	85 c0                	test   %eax,%eax
80103da9:	0f 84 c8 00 00 00    	je     80103e77 <pipealloc+0xff>
80103daf:	e8 78 d1 ff ff       	call   80100f2c <filealloc>
80103db4:	8b 55 0c             	mov    0xc(%ebp),%edx
80103db7:	89 02                	mov    %eax,(%edx)
80103db9:	8b 45 0c             	mov    0xc(%ebp),%eax
80103dbc:	8b 00                	mov    (%eax),%eax
80103dbe:	85 c0                	test   %eax,%eax
80103dc0:	0f 84 b1 00 00 00    	je     80103e77 <pipealloc+0xff>
    goto bad;
  if((p = (struct pipe*)kalloc()) == 0)
80103dc6:	e8 46 ee ff ff       	call   80102c11 <kalloc>
80103dcb:	89 45 f4             	mov    %eax,-0xc(%ebp)
80103dce:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80103dd2:	0f 84 9e 00 00 00    	je     80103e76 <pipealloc+0xfe>
    goto bad;
  p->readopen = 1;
80103dd8:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103ddb:	c7 80 3c 02 00 00 01 	movl   $0x1,0x23c(%eax)
80103de2:	00 00 00 
  p->writeopen = 1;
80103de5:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103de8:	c7 80 40 02 00 00 01 	movl   $0x1,0x240(%eax)
80103def:	00 00 00 
  p->nwrite = 0;
80103df2:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103df5:	c7 80 38 02 00 00 00 	movl   $0x0,0x238(%eax)
80103dfc:	00 00 00 
  p->nread = 0;
80103dff:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103e02:	c7 80 34 02 00 00 00 	movl   $0x0,0x234(%eax)
80103e09:	00 00 00 
  initlock(&p->lock, "pipe");
80103e0c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103e0f:	c7 44 24 04 f0 8b 10 	movl   $0x80108bf0,0x4(%esp)
80103e16:	80 
80103e17:	89 04 24             	mov    %eax,(%esp)
80103e1a:	e8 0b 0e 00 00       	call   80104c2a <initlock>
  (*f0)->type = FD_PIPE;
80103e1f:	8b 45 08             	mov    0x8(%ebp),%eax
80103e22:	8b 00                	mov    (%eax),%eax
80103e24:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
  (*f0)->readable = 1;
80103e2a:	8b 45 08             	mov    0x8(%ebp),%eax
80103e2d:	8b 00                	mov    (%eax),%eax
80103e2f:	c6 40 08 01          	movb   $0x1,0x8(%eax)
  (*f0)->writable = 0;
80103e33:	8b 45 08             	mov    0x8(%ebp),%eax
80103e36:	8b 00                	mov    (%eax),%eax
80103e38:	c6 40 09 00          	movb   $0x0,0x9(%eax)
  (*f0)->pipe = p;
80103e3c:	8b 45 08             	mov    0x8(%ebp),%eax
80103e3f:	8b 00                	mov    (%eax),%eax
80103e41:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103e44:	89 50 0c             	mov    %edx,0xc(%eax)
  (*f1)->type = FD_PIPE;
80103e47:	8b 45 0c             	mov    0xc(%ebp),%eax
80103e4a:	8b 00                	mov    (%eax),%eax
80103e4c:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
  (*f1)->readable = 0;
80103e52:	8b 45 0c             	mov    0xc(%ebp),%eax
80103e55:	8b 00                	mov    (%eax),%eax
80103e57:	c6 40 08 00          	movb   $0x0,0x8(%eax)
  (*f1)->writable = 1;
80103e5b:	8b 45 0c             	mov    0xc(%ebp),%eax
80103e5e:	8b 00                	mov    (%eax),%eax
80103e60:	c6 40 09 01          	movb   $0x1,0x9(%eax)
  (*f1)->pipe = p;
80103e64:	8b 45 0c             	mov    0xc(%ebp),%eax
80103e67:	8b 00                	mov    (%eax),%eax
80103e69:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103e6c:	89 50 0c             	mov    %edx,0xc(%eax)
  return 0;
80103e6f:	b8 00 00 00 00       	mov    $0x0,%eax
80103e74:	eb 43                	jmp    80103eb9 <pipealloc+0x141>
  p = 0;
  *f0 = *f1 = 0;
  if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
    goto bad;
  if((p = (struct pipe*)kalloc()) == 0)
    goto bad;
80103e76:	90                   	nop
  (*f1)->pipe = p;
  return 0;

//PAGEBREAK: 20
 bad:
  if(p)
80103e77:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80103e7b:	74 0b                	je     80103e88 <pipealloc+0x110>
    kfree((char*)p);
80103e7d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103e80:	89 04 24             	mov    %eax,(%esp)
80103e83:	e8 f0 ec ff ff       	call   80102b78 <kfree>
  if(*f0)
80103e88:	8b 45 08             	mov    0x8(%ebp),%eax
80103e8b:	8b 00                	mov    (%eax),%eax
80103e8d:	85 c0                	test   %eax,%eax
80103e8f:	74 0d                	je     80103e9e <pipealloc+0x126>
    fileclose(*f0);
80103e91:	8b 45 08             	mov    0x8(%ebp),%eax
80103e94:	8b 00                	mov    (%eax),%eax
80103e96:	89 04 24             	mov    %eax,(%esp)
80103e99:	e8 36 d1 ff ff       	call   80100fd4 <fileclose>
  if(*f1)
80103e9e:	8b 45 0c             	mov    0xc(%ebp),%eax
80103ea1:	8b 00                	mov    (%eax),%eax
80103ea3:	85 c0                	test   %eax,%eax
80103ea5:	74 0d                	je     80103eb4 <pipealloc+0x13c>
    fileclose(*f1);
80103ea7:	8b 45 0c             	mov    0xc(%ebp),%eax
80103eaa:	8b 00                	mov    (%eax),%eax
80103eac:	89 04 24             	mov    %eax,(%esp)
80103eaf:	e8 20 d1 ff ff       	call   80100fd4 <fileclose>
  return -1;
80103eb4:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80103eb9:	c9                   	leave  
80103eba:	c3                   	ret    

80103ebb <pipeclose>:

void
pipeclose(struct pipe *p, int writable)
{
80103ebb:	55                   	push   %ebp
80103ebc:	89 e5                	mov    %esp,%ebp
80103ebe:	83 ec 18             	sub    $0x18,%esp
  acquire(&p->lock);
80103ec1:	8b 45 08             	mov    0x8(%ebp),%eax
80103ec4:	89 04 24             	mov    %eax,(%esp)
80103ec7:	e8 7f 0d 00 00       	call   80104c4b <acquire>
  if(writable){
80103ecc:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
80103ed0:	74 1f                	je     80103ef1 <pipeclose+0x36>
    p->writeopen = 0;
80103ed2:	8b 45 08             	mov    0x8(%ebp),%eax
80103ed5:	c7 80 40 02 00 00 00 	movl   $0x0,0x240(%eax)
80103edc:	00 00 00 
    wakeup(&p->nread);
80103edf:	8b 45 08             	mov    0x8(%ebp),%eax
80103ee2:	05 34 02 00 00       	add    $0x234,%eax
80103ee7:	89 04 24             	mov    %eax,(%esp)
80103eea:	e8 73 0b 00 00       	call   80104a62 <wakeup>
80103eef:	eb 1d                	jmp    80103f0e <pipeclose+0x53>
  } else {
    p->readopen = 0;
80103ef1:	8b 45 08             	mov    0x8(%ebp),%eax
80103ef4:	c7 80 3c 02 00 00 00 	movl   $0x0,0x23c(%eax)
80103efb:	00 00 00 
    wakeup(&p->nwrite);
80103efe:	8b 45 08             	mov    0x8(%ebp),%eax
80103f01:	05 38 02 00 00       	add    $0x238,%eax
80103f06:	89 04 24             	mov    %eax,(%esp)
80103f09:	e8 54 0b 00 00       	call   80104a62 <wakeup>
  }
  if(p->readopen == 0 && p->writeopen == 0){
80103f0e:	8b 45 08             	mov    0x8(%ebp),%eax
80103f11:	8b 80 3c 02 00 00    	mov    0x23c(%eax),%eax
80103f17:	85 c0                	test   %eax,%eax
80103f19:	75 25                	jne    80103f40 <pipeclose+0x85>
80103f1b:	8b 45 08             	mov    0x8(%ebp),%eax
80103f1e:	8b 80 40 02 00 00    	mov    0x240(%eax),%eax
80103f24:	85 c0                	test   %eax,%eax
80103f26:	75 18                	jne    80103f40 <pipeclose+0x85>
    release(&p->lock);
80103f28:	8b 45 08             	mov    0x8(%ebp),%eax
80103f2b:	89 04 24             	mov    %eax,(%esp)
80103f2e:	e8 7a 0d 00 00       	call   80104cad <release>
    kfree((char*)p);
80103f33:	8b 45 08             	mov    0x8(%ebp),%eax
80103f36:	89 04 24             	mov    %eax,(%esp)
80103f39:	e8 3a ec ff ff       	call   80102b78 <kfree>
80103f3e:	eb 0b                	jmp    80103f4b <pipeclose+0x90>
  } else
    release(&p->lock);
80103f40:	8b 45 08             	mov    0x8(%ebp),%eax
80103f43:	89 04 24             	mov    %eax,(%esp)
80103f46:	e8 62 0d 00 00       	call   80104cad <release>
}
80103f4b:	c9                   	leave  
80103f4c:	c3                   	ret    

80103f4d <pipewrite>:

//PAGEBREAK: 40
int
pipewrite(struct pipe *p, char *addr, int n)
{
80103f4d:	55                   	push   %ebp
80103f4e:	89 e5                	mov    %esp,%ebp
80103f50:	53                   	push   %ebx
80103f51:	83 ec 24             	sub    $0x24,%esp
  int i;

  acquire(&p->lock);
80103f54:	8b 45 08             	mov    0x8(%ebp),%eax
80103f57:	89 04 24             	mov    %eax,(%esp)
80103f5a:	e8 ec 0c 00 00       	call   80104c4b <acquire>
  for(i = 0; i < n; i++){
80103f5f:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80103f66:	e9 a6 00 00 00       	jmp    80104011 <pipewrite+0xc4>
    while(p->nwrite == p->nread + PIPESIZE){  //DOC: pipewrite-full
      if(p->readopen == 0 || proc->killed){
80103f6b:	8b 45 08             	mov    0x8(%ebp),%eax
80103f6e:	8b 80 3c 02 00 00    	mov    0x23c(%eax),%eax
80103f74:	85 c0                	test   %eax,%eax
80103f76:	74 0d                	je     80103f85 <pipewrite+0x38>
80103f78:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80103f7e:	8b 40 24             	mov    0x24(%eax),%eax
80103f81:	85 c0                	test   %eax,%eax
80103f83:	74 15                	je     80103f9a <pipewrite+0x4d>
        release(&p->lock);
80103f85:	8b 45 08             	mov    0x8(%ebp),%eax
80103f88:	89 04 24             	mov    %eax,(%esp)
80103f8b:	e8 1d 0d 00 00       	call   80104cad <release>
        return -1;
80103f90:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80103f95:	e9 9d 00 00 00       	jmp    80104037 <pipewrite+0xea>
      }
      wakeup(&p->nread);
80103f9a:	8b 45 08             	mov    0x8(%ebp),%eax
80103f9d:	05 34 02 00 00       	add    $0x234,%eax
80103fa2:	89 04 24             	mov    %eax,(%esp)
80103fa5:	e8 b8 0a 00 00       	call   80104a62 <wakeup>
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
80103faa:	8b 45 08             	mov    0x8(%ebp),%eax
80103fad:	8b 55 08             	mov    0x8(%ebp),%edx
80103fb0:	81 c2 38 02 00 00    	add    $0x238,%edx
80103fb6:	89 44 24 04          	mov    %eax,0x4(%esp)
80103fba:	89 14 24             	mov    %edx,(%esp)
80103fbd:	e8 c7 09 00 00       	call   80104989 <sleep>
80103fc2:	eb 01                	jmp    80103fc5 <pipewrite+0x78>
{
  int i;

  acquire(&p->lock);
  for(i = 0; i < n; i++){
    while(p->nwrite == p->nread + PIPESIZE){  //DOC: pipewrite-full
80103fc4:	90                   	nop
80103fc5:	8b 45 08             	mov    0x8(%ebp),%eax
80103fc8:	8b 90 38 02 00 00    	mov    0x238(%eax),%edx
80103fce:	8b 45 08             	mov    0x8(%ebp),%eax
80103fd1:	8b 80 34 02 00 00    	mov    0x234(%eax),%eax
80103fd7:	05 00 02 00 00       	add    $0x200,%eax
80103fdc:	39 c2                	cmp    %eax,%edx
80103fde:	74 8b                	je     80103f6b <pipewrite+0x1e>
        return -1;
      }
      wakeup(&p->nread);
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
    }
    p->data[p->nwrite++ % PIPESIZE] = addr[i];
80103fe0:	8b 45 08             	mov    0x8(%ebp),%eax
80103fe3:	8b 80 38 02 00 00    	mov    0x238(%eax),%eax
80103fe9:	89 c3                	mov    %eax,%ebx
80103feb:	81 e3 ff 01 00 00    	and    $0x1ff,%ebx
80103ff1:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103ff4:	03 55 0c             	add    0xc(%ebp),%edx
80103ff7:	0f b6 0a             	movzbl (%edx),%ecx
80103ffa:	8b 55 08             	mov    0x8(%ebp),%edx
80103ffd:	88 4c 1a 34          	mov    %cl,0x34(%edx,%ebx,1)
80104001:	8d 50 01             	lea    0x1(%eax),%edx
80104004:	8b 45 08             	mov    0x8(%ebp),%eax
80104007:	89 90 38 02 00 00    	mov    %edx,0x238(%eax)
pipewrite(struct pipe *p, char *addr, int n)
{
  int i;

  acquire(&p->lock);
  for(i = 0; i < n; i++){
8010400d:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80104011:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104014:	3b 45 10             	cmp    0x10(%ebp),%eax
80104017:	7c ab                	jl     80103fc4 <pipewrite+0x77>
      wakeup(&p->nread);
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
    }
    p->data[p->nwrite++ % PIPESIZE] = addr[i];
  }
  wakeup(&p->nread);  //DOC: pipewrite-wakeup1
80104019:	8b 45 08             	mov    0x8(%ebp),%eax
8010401c:	05 34 02 00 00       	add    $0x234,%eax
80104021:	89 04 24             	mov    %eax,(%esp)
80104024:	e8 39 0a 00 00       	call   80104a62 <wakeup>
  release(&p->lock);
80104029:	8b 45 08             	mov    0x8(%ebp),%eax
8010402c:	89 04 24             	mov    %eax,(%esp)
8010402f:	e8 79 0c 00 00       	call   80104cad <release>
  return n;
80104034:	8b 45 10             	mov    0x10(%ebp),%eax
}
80104037:	83 c4 24             	add    $0x24,%esp
8010403a:	5b                   	pop    %ebx
8010403b:	5d                   	pop    %ebp
8010403c:	c3                   	ret    

8010403d <piperead>:

int
piperead(struct pipe *p, char *addr, int n)
{
8010403d:	55                   	push   %ebp
8010403e:	89 e5                	mov    %esp,%ebp
80104040:	53                   	push   %ebx
80104041:	83 ec 24             	sub    $0x24,%esp
  int i;

  acquire(&p->lock);
80104044:	8b 45 08             	mov    0x8(%ebp),%eax
80104047:	89 04 24             	mov    %eax,(%esp)
8010404a:	e8 fc 0b 00 00       	call   80104c4b <acquire>
  while(p->nread == p->nwrite && p->writeopen){  //DOC: pipe-empty
8010404f:	eb 3a                	jmp    8010408b <piperead+0x4e>
    if(proc->killed){
80104051:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104057:	8b 40 24             	mov    0x24(%eax),%eax
8010405a:	85 c0                	test   %eax,%eax
8010405c:	74 15                	je     80104073 <piperead+0x36>
      release(&p->lock);
8010405e:	8b 45 08             	mov    0x8(%ebp),%eax
80104061:	89 04 24             	mov    %eax,(%esp)
80104064:	e8 44 0c 00 00       	call   80104cad <release>
      return -1;
80104069:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010406e:	e9 b6 00 00 00       	jmp    80104129 <piperead+0xec>
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
80104073:	8b 45 08             	mov    0x8(%ebp),%eax
80104076:	8b 55 08             	mov    0x8(%ebp),%edx
80104079:	81 c2 34 02 00 00    	add    $0x234,%edx
8010407f:	89 44 24 04          	mov    %eax,0x4(%esp)
80104083:	89 14 24             	mov    %edx,(%esp)
80104086:	e8 fe 08 00 00       	call   80104989 <sleep>
piperead(struct pipe *p, char *addr, int n)
{
  int i;

  acquire(&p->lock);
  while(p->nread == p->nwrite && p->writeopen){  //DOC: pipe-empty
8010408b:	8b 45 08             	mov    0x8(%ebp),%eax
8010408e:	8b 90 34 02 00 00    	mov    0x234(%eax),%edx
80104094:	8b 45 08             	mov    0x8(%ebp),%eax
80104097:	8b 80 38 02 00 00    	mov    0x238(%eax),%eax
8010409d:	39 c2                	cmp    %eax,%edx
8010409f:	75 0d                	jne    801040ae <piperead+0x71>
801040a1:	8b 45 08             	mov    0x8(%ebp),%eax
801040a4:	8b 80 40 02 00 00    	mov    0x240(%eax),%eax
801040aa:	85 c0                	test   %eax,%eax
801040ac:	75 a3                	jne    80104051 <piperead+0x14>
      release(&p->lock);
      return -1;
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
  }
  for(i = 0; i < n; i++){  //DOC: piperead-copy
801040ae:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801040b5:	eb 49                	jmp    80104100 <piperead+0xc3>
    if(p->nread == p->nwrite)
801040b7:	8b 45 08             	mov    0x8(%ebp),%eax
801040ba:	8b 90 34 02 00 00    	mov    0x234(%eax),%edx
801040c0:	8b 45 08             	mov    0x8(%ebp),%eax
801040c3:	8b 80 38 02 00 00    	mov    0x238(%eax),%eax
801040c9:	39 c2                	cmp    %eax,%edx
801040cb:	74 3d                	je     8010410a <piperead+0xcd>
      break;
    addr[i] = p->data[p->nread++ % PIPESIZE];
801040cd:	8b 45 f4             	mov    -0xc(%ebp),%eax
801040d0:	89 c2                	mov    %eax,%edx
801040d2:	03 55 0c             	add    0xc(%ebp),%edx
801040d5:	8b 45 08             	mov    0x8(%ebp),%eax
801040d8:	8b 80 34 02 00 00    	mov    0x234(%eax),%eax
801040de:	89 c3                	mov    %eax,%ebx
801040e0:	81 e3 ff 01 00 00    	and    $0x1ff,%ebx
801040e6:	8b 4d 08             	mov    0x8(%ebp),%ecx
801040e9:	0f b6 4c 19 34       	movzbl 0x34(%ecx,%ebx,1),%ecx
801040ee:	88 0a                	mov    %cl,(%edx)
801040f0:	8d 50 01             	lea    0x1(%eax),%edx
801040f3:	8b 45 08             	mov    0x8(%ebp),%eax
801040f6:	89 90 34 02 00 00    	mov    %edx,0x234(%eax)
      release(&p->lock);
      return -1;
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
  }
  for(i = 0; i < n; i++){  //DOC: piperead-copy
801040fc:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80104100:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104103:	3b 45 10             	cmp    0x10(%ebp),%eax
80104106:	7c af                	jl     801040b7 <piperead+0x7a>
80104108:	eb 01                	jmp    8010410b <piperead+0xce>
    if(p->nread == p->nwrite)
      break;
8010410a:	90                   	nop
    addr[i] = p->data[p->nread++ % PIPESIZE];
  }
  wakeup(&p->nwrite);  //DOC: piperead-wakeup
8010410b:	8b 45 08             	mov    0x8(%ebp),%eax
8010410e:	05 38 02 00 00       	add    $0x238,%eax
80104113:	89 04 24             	mov    %eax,(%esp)
80104116:	e8 47 09 00 00       	call   80104a62 <wakeup>
  release(&p->lock);
8010411b:	8b 45 08             	mov    0x8(%ebp),%eax
8010411e:	89 04 24             	mov    %eax,(%esp)
80104121:	e8 87 0b 00 00       	call   80104cad <release>
  return i;
80104126:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80104129:	83 c4 24             	add    $0x24,%esp
8010412c:	5b                   	pop    %ebx
8010412d:	5d                   	pop    %ebp
8010412e:	c3                   	ret    
	...

80104130 <readeflags>:
  asm volatile("ltr %0" : : "r" (sel));
}

static inline uint
readeflags(void)
{
80104130:	55                   	push   %ebp
80104131:	89 e5                	mov    %esp,%ebp
80104133:	53                   	push   %ebx
80104134:	83 ec 10             	sub    $0x10,%esp
  uint eflags;
  asm volatile("pushfl; popl %0" : "=r" (eflags));
80104137:	9c                   	pushf  
80104138:	5b                   	pop    %ebx
80104139:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  return eflags;
8010413c:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
8010413f:	83 c4 10             	add    $0x10,%esp
80104142:	5b                   	pop    %ebx
80104143:	5d                   	pop    %ebp
80104144:	c3                   	ret    

80104145 <sti>:
  asm volatile("cli");
}

static inline void
sti(void)
{
80104145:	55                   	push   %ebp
80104146:	89 e5                	mov    %esp,%ebp
  asm volatile("sti");
80104148:	fb                   	sti    
}
80104149:	5d                   	pop    %ebp
8010414a:	c3                   	ret    

8010414b <pinit>:

static void wakeup1(void *chan);

void
pinit(void)
{
8010414b:	55                   	push   %ebp
8010414c:	89 e5                	mov    %esp,%ebp
8010414e:	83 ec 18             	sub    $0x18,%esp
  initlock(&ptable.lock, "ptable");
80104151:	c7 44 24 04 f8 8b 10 	movl   $0x80108bf8,0x4(%esp)
80104158:	80 
80104159:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
80104160:	e8 c5 0a 00 00       	call   80104c2a <initlock>
}
80104165:	c9                   	leave  
80104166:	c3                   	ret    

80104167 <allocproc>:
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
80104167:	55                   	push   %ebp
80104168:	89 e5                	mov    %esp,%ebp
8010416a:	83 ec 28             	sub    $0x28,%esp
  struct proc *p;
  char *sp;

  acquire(&ptable.lock);
8010416d:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
80104174:	e8 d2 0a 00 00       	call   80104c4b <acquire>
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104179:	c7 45 f4 74 0f 11 80 	movl   $0x80110f74,-0xc(%ebp)
80104180:	eb 0e                	jmp    80104190 <allocproc+0x29>
    if(p->state == UNUSED)
80104182:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104185:	8b 40 0c             	mov    0xc(%eax),%eax
80104188:	85 c0                	test   %eax,%eax
8010418a:	74 23                	je     801041af <allocproc+0x48>
{
  struct proc *p;
  char *sp;

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
8010418c:	83 45 f4 7c          	addl   $0x7c,-0xc(%ebp)
80104190:	81 7d f4 74 2e 11 80 	cmpl   $0x80112e74,-0xc(%ebp)
80104197:	72 e9                	jb     80104182 <allocproc+0x1b>
    if(p->state == UNUSED)
      goto found;
  release(&ptable.lock);
80104199:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
801041a0:	e8 08 0b 00 00       	call   80104cad <release>
  return 0;
801041a5:	b8 00 00 00 00       	mov    $0x0,%eax
801041aa:	e9 b5 00 00 00       	jmp    80104264 <allocproc+0xfd>
  char *sp;

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
    if(p->state == UNUSED)
      goto found;
801041af:	90                   	nop
  release(&ptable.lock);
  return 0;

found:
  p->state = EMBRYO;
801041b0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801041b3:	c7 40 0c 01 00 00 00 	movl   $0x1,0xc(%eax)
  p->pid = nextpid++;
801041ba:	a1 04 c0 10 80       	mov    0x8010c004,%eax
801041bf:	8b 55 f4             	mov    -0xc(%ebp),%edx
801041c2:	89 42 10             	mov    %eax,0x10(%edx)
801041c5:	83 c0 01             	add    $0x1,%eax
801041c8:	a3 04 c0 10 80       	mov    %eax,0x8010c004
  release(&ptable.lock);
801041cd:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
801041d4:	e8 d4 0a 00 00       	call   80104cad <release>

  // Allocate kernel stack.
  if((p->kstack = kalloc()) == 0){
801041d9:	e8 33 ea ff ff       	call   80102c11 <kalloc>
801041de:	8b 55 f4             	mov    -0xc(%ebp),%edx
801041e1:	89 42 08             	mov    %eax,0x8(%edx)
801041e4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801041e7:	8b 40 08             	mov    0x8(%eax),%eax
801041ea:	85 c0                	test   %eax,%eax
801041ec:	75 11                	jne    801041ff <allocproc+0x98>
    p->state = UNUSED;
801041ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
801041f1:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    return 0;
801041f8:	b8 00 00 00 00       	mov    $0x0,%eax
801041fd:	eb 65                	jmp    80104264 <allocproc+0xfd>
  }
  sp = p->kstack + KSTACKSIZE;
801041ff:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104202:	8b 40 08             	mov    0x8(%eax),%eax
80104205:	05 00 10 00 00       	add    $0x1000,%eax
8010420a:	89 45 f0             	mov    %eax,-0x10(%ebp)

  // Leave room for trap frame.
  sp -= sizeof *p->tf;
8010420d:	83 6d f0 4c          	subl   $0x4c,-0x10(%ebp)
  p->tf = (struct trapframe*)sp;
80104211:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104214:	8b 55 f0             	mov    -0x10(%ebp),%edx
80104217:	89 50 18             	mov    %edx,0x18(%eax)

  // Set up new context to start executing at forkret,
  // which returns to trapret.
  sp -= 4;
8010421a:	83 6d f0 04          	subl   $0x4,-0x10(%ebp)
  *(uint*)sp = (uint)trapret;
8010421e:	ba c0 62 10 80       	mov    $0x801062c0,%edx
80104223:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104226:	89 10                	mov    %edx,(%eax)

  sp -= sizeof *p->context;
80104228:	83 6d f0 14          	subl   $0x14,-0x10(%ebp)
  p->context = (struct context*)sp;
8010422c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010422f:	8b 55 f0             	mov    -0x10(%ebp),%edx
80104232:	89 50 1c             	mov    %edx,0x1c(%eax)
  memset(p->context, 0, sizeof *p->context);
80104235:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104238:	8b 40 1c             	mov    0x1c(%eax),%eax
8010423b:	c7 44 24 08 14 00 00 	movl   $0x14,0x8(%esp)
80104242:	00 
80104243:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
8010424a:	00 
8010424b:	89 04 24             	mov    %eax,(%esp)
8010424e:	e8 47 0c 00 00       	call   80104e9a <memset>
  p->context->eip = (uint)forkret;
80104253:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104256:	8b 40 1c             	mov    0x1c(%eax),%eax
80104259:	ba 5d 49 10 80       	mov    $0x8010495d,%edx
8010425e:	89 50 10             	mov    %edx,0x10(%eax)

  return p;
80104261:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80104264:	c9                   	leave  
80104265:	c3                   	ret    

80104266 <userinit>:

//PAGEBREAK: 32
// Set up first user process.
void
userinit(void)
{
80104266:	55                   	push   %ebp
80104267:	89 e5                	mov    %esp,%ebp
80104269:	83 ec 28             	sub    $0x28,%esp
  struct proc *p;
  extern char _binary_initcode_start[], _binary_initcode_size[];

  p = allocproc();
8010426c:	e8 f6 fe ff ff       	call   80104167 <allocproc>
80104271:	89 45 f4             	mov    %eax,-0xc(%ebp)
  initproc = p;
80104274:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104277:	a3 48 c6 10 80       	mov    %eax,0x8010c648
  if((p->pgdir = setupkvm()) == 0)
8010427c:	e8 05 38 00 00       	call   80107a86 <setupkvm>
80104281:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104284:	89 42 04             	mov    %eax,0x4(%edx)
80104287:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010428a:	8b 40 04             	mov    0x4(%eax),%eax
8010428d:	85 c0                	test   %eax,%eax
8010428f:	75 0c                	jne    8010429d <userinit+0x37>
    panic("userinit: out of memory?");
80104291:	c7 04 24 ff 8b 10 80 	movl   $0x80108bff,(%esp)
80104298:	e8 b8 c2 ff ff       	call   80100555 <panic>
  inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
8010429d:	ba 2c 00 00 00       	mov    $0x2c,%edx
801042a2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042a5:	8b 40 04             	mov    0x4(%eax),%eax
801042a8:	89 54 24 08          	mov    %edx,0x8(%esp)
801042ac:	c7 44 24 04 e0 c4 10 	movl   $0x8010c4e0,0x4(%esp)
801042b3:	80 
801042b4:	89 04 24             	mov    %eax,(%esp)
801042b7:	e8 4d 3a 00 00       	call   80107d09 <inituvm>

  p->sz = PGSIZE;
801042bc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042bf:	c7 00 00 10 00 00    	movl   $0x1000,(%eax)
  memset(p->tf, 0, sizeof(*p->tf));
801042c5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042c8:	8b 40 18             	mov    0x18(%eax),%eax
801042cb:	c7 44 24 08 4c 00 00 	movl   $0x4c,0x8(%esp)
801042d2:	00 
801042d3:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801042da:	00 
801042db:	89 04 24             	mov    %eax,(%esp)
801042de:	e8 b7 0b 00 00       	call   80104e9a <memset>
  p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
801042e3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042e6:	8b 40 18             	mov    0x18(%eax),%eax
801042e9:	66 c7 40 3c 23 00    	movw   $0x23,0x3c(%eax)
  p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
801042ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042f2:	8b 40 18             	mov    0x18(%eax),%eax
801042f5:	66 c7 40 2c 2b 00    	movw   $0x2b,0x2c(%eax)
  p->tf->es = p->tf->ds;
801042fb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042fe:	8b 40 18             	mov    0x18(%eax),%eax
80104301:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104304:	8b 52 18             	mov    0x18(%edx),%edx
80104307:	0f b7 52 2c          	movzwl 0x2c(%edx),%edx
8010430b:	66 89 50 28          	mov    %dx,0x28(%eax)
  p->tf->ss = p->tf->ds;
8010430f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104312:	8b 40 18             	mov    0x18(%eax),%eax
80104315:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104318:	8b 52 18             	mov    0x18(%edx),%edx
8010431b:	0f b7 52 2c          	movzwl 0x2c(%edx),%edx
8010431f:	66 89 50 48          	mov    %dx,0x48(%eax)
  p->tf->eflags = FL_IF;
80104323:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104326:	8b 40 18             	mov    0x18(%eax),%eax
80104329:	c7 40 40 00 02 00 00 	movl   $0x200,0x40(%eax)
  p->tf->esp = PGSIZE;
80104330:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104333:	8b 40 18             	mov    0x18(%eax),%eax
80104336:	c7 40 44 00 10 00 00 	movl   $0x1000,0x44(%eax)
  p->tf->eip = 0;  // beginning of initcode.S
8010433d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104340:	8b 40 18             	mov    0x18(%eax),%eax
80104343:	c7 40 38 00 00 00 00 	movl   $0x0,0x38(%eax)

  safestrcpy(p->name, "initcode", sizeof(p->name));
8010434a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010434d:	83 c0 6c             	add    $0x6c,%eax
80104350:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
80104357:	00 
80104358:	c7 44 24 04 18 8c 10 	movl   $0x80108c18,0x4(%esp)
8010435f:	80 
80104360:	89 04 24             	mov    %eax,(%esp)
80104363:	e8 62 0d 00 00       	call   801050ca <safestrcpy>
  p->cwd = namei("/");
80104368:	c7 04 24 21 8c 10 80 	movl   $0x80108c21,(%esp)
8010436f:	e8 a6 e0 ff ff       	call   8010241a <namei>
80104374:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104377:	89 42 68             	mov    %eax,0x68(%edx)

  p->state = RUNNABLE;
8010437a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010437d:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
}
80104384:	c9                   	leave  
80104385:	c3                   	ret    

80104386 <growproc>:

// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
80104386:	55                   	push   %ebp
80104387:	89 e5                	mov    %esp,%ebp
80104389:	83 ec 28             	sub    $0x28,%esp
  uint sz;

  sz = proc->sz;
8010438c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104392:	8b 00                	mov    (%eax),%eax
80104394:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(n > 0){
80104397:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010439b:	7e 34                	jle    801043d1 <growproc+0x4b>
    if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
8010439d:	8b 45 08             	mov    0x8(%ebp),%eax
801043a0:	89 c2                	mov    %eax,%edx
801043a2:	03 55 f4             	add    -0xc(%ebp),%edx
801043a5:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801043ab:	8b 40 04             	mov    0x4(%eax),%eax
801043ae:	89 54 24 08          	mov    %edx,0x8(%esp)
801043b2:	8b 55 f4             	mov    -0xc(%ebp),%edx
801043b5:	89 54 24 04          	mov    %edx,0x4(%esp)
801043b9:	89 04 24             	mov    %eax,(%esp)
801043bc:	e8 c2 3a 00 00       	call   80107e83 <allocuvm>
801043c1:	89 45 f4             	mov    %eax,-0xc(%ebp)
801043c4:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801043c8:	75 41                	jne    8010440b <growproc+0x85>
      return -1;
801043ca:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801043cf:	eb 58                	jmp    80104429 <growproc+0xa3>
  } else if(n < 0){
801043d1:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
801043d5:	79 34                	jns    8010440b <growproc+0x85>
    if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0)
801043d7:	8b 45 08             	mov    0x8(%ebp),%eax
801043da:	89 c2                	mov    %eax,%edx
801043dc:	03 55 f4             	add    -0xc(%ebp),%edx
801043df:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801043e5:	8b 40 04             	mov    0x4(%eax),%eax
801043e8:	89 54 24 08          	mov    %edx,0x8(%esp)
801043ec:	8b 55 f4             	mov    -0xc(%ebp),%edx
801043ef:	89 54 24 04          	mov    %edx,0x4(%esp)
801043f3:	89 04 24             	mov    %eax,(%esp)
801043f6:	e8 62 3b 00 00       	call   80107f5d <deallocuvm>
801043fb:	89 45 f4             	mov    %eax,-0xc(%ebp)
801043fe:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80104402:	75 07                	jne    8010440b <growproc+0x85>
      return -1;
80104404:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104409:	eb 1e                	jmp    80104429 <growproc+0xa3>
  }
  proc->sz = sz;
8010440b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104411:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104414:	89 10                	mov    %edx,(%eax)
  switchuvm(proc);
80104416:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010441c:	89 04 24             	mov    %eax,(%esp)
8010441f:	e8 7e 37 00 00       	call   80107ba2 <switchuvm>
  return 0;
80104424:	b8 00 00 00 00       	mov    $0x0,%eax
}
80104429:	c9                   	leave  
8010442a:	c3                   	ret    

8010442b <fork>:
// Create a new process copying p as the parent.
// Sets up stack to return as if from system call.
// Caller must set state of returned proc to RUNNABLE.
int
fork(void)
{
8010442b:	55                   	push   %ebp
8010442c:	89 e5                	mov    %esp,%ebp
8010442e:	57                   	push   %edi
8010442f:	56                   	push   %esi
80104430:	53                   	push   %ebx
80104431:	83 ec 2c             	sub    $0x2c,%esp
  int i, pid;
  struct proc *np;

  // Allocate process.
  if((np = allocproc()) == 0)
80104434:	e8 2e fd ff ff       	call   80104167 <allocproc>
80104439:	89 45 e0             	mov    %eax,-0x20(%ebp)
8010443c:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
80104440:	75 0a                	jne    8010444c <fork+0x21>
    return -1;
80104442:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104447:	e9 3a 01 00 00       	jmp    80104586 <fork+0x15b>

  // Copy process state from p.
  if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
8010444c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104452:	8b 10                	mov    (%eax),%edx
80104454:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010445a:	8b 40 04             	mov    0x4(%eax),%eax
8010445d:	89 54 24 04          	mov    %edx,0x4(%esp)
80104461:	89 04 24             	mov    %eax,(%esp)
80104464:	e8 ab 3c 00 00       	call   80108114 <copyuvm>
80104469:	8b 55 e0             	mov    -0x20(%ebp),%edx
8010446c:	89 42 04             	mov    %eax,0x4(%edx)
8010446f:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104472:	8b 40 04             	mov    0x4(%eax),%eax
80104475:	85 c0                	test   %eax,%eax
80104477:	75 2c                	jne    801044a5 <fork+0x7a>
    kfree(np->kstack);
80104479:	8b 45 e0             	mov    -0x20(%ebp),%eax
8010447c:	8b 40 08             	mov    0x8(%eax),%eax
8010447f:	89 04 24             	mov    %eax,(%esp)
80104482:	e8 f1 e6 ff ff       	call   80102b78 <kfree>
    np->kstack = 0;
80104487:	8b 45 e0             	mov    -0x20(%ebp),%eax
8010448a:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
    np->state = UNUSED;
80104491:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104494:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    return -1;
8010449b:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801044a0:	e9 e1 00 00 00       	jmp    80104586 <fork+0x15b>
  }
  np->sz = proc->sz;
801044a5:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801044ab:	8b 10                	mov    (%eax),%edx
801044ad:	8b 45 e0             	mov    -0x20(%ebp),%eax
801044b0:	89 10                	mov    %edx,(%eax)
  np->parent = proc;
801044b2:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
801044b9:	8b 45 e0             	mov    -0x20(%ebp),%eax
801044bc:	89 50 14             	mov    %edx,0x14(%eax)
  *np->tf = *proc->tf;
801044bf:	8b 45 e0             	mov    -0x20(%ebp),%eax
801044c2:	8b 50 18             	mov    0x18(%eax),%edx
801044c5:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801044cb:	8b 40 18             	mov    0x18(%eax),%eax
801044ce:	89 c3                	mov    %eax,%ebx
801044d0:	b8 13 00 00 00       	mov    $0x13,%eax
801044d5:	89 d7                	mov    %edx,%edi
801044d7:	89 de                	mov    %ebx,%esi
801044d9:	89 c1                	mov    %eax,%ecx
801044db:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)

  // Clear %eax so that fork returns 0 in the child.
  np->tf->eax = 0;
801044dd:	8b 45 e0             	mov    -0x20(%ebp),%eax
801044e0:	8b 40 18             	mov    0x18(%eax),%eax
801044e3:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)

  for(i = 0; i < NOFILE; i++)
801044ea:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
801044f1:	eb 3d                	jmp    80104530 <fork+0x105>
    if(proc->ofile[i])
801044f3:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801044f9:	8b 55 e4             	mov    -0x1c(%ebp),%edx
801044fc:	83 c2 08             	add    $0x8,%edx
801044ff:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
80104503:	85 c0                	test   %eax,%eax
80104505:	74 25                	je     8010452c <fork+0x101>
      np->ofile[i] = filedup(proc->ofile[i]);
80104507:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010450d:	8b 55 e4             	mov    -0x1c(%ebp),%edx
80104510:	83 c2 08             	add    $0x8,%edx
80104513:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
80104517:	89 04 24             	mov    %eax,(%esp)
8010451a:	e8 6d ca ff ff       	call   80100f8c <filedup>
8010451f:	8b 55 e0             	mov    -0x20(%ebp),%edx
80104522:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
80104525:	83 c1 08             	add    $0x8,%ecx
80104528:	89 44 8a 08          	mov    %eax,0x8(%edx,%ecx,4)
  *np->tf = *proc->tf;

  // Clear %eax so that fork returns 0 in the child.
  np->tf->eax = 0;

  for(i = 0; i < NOFILE; i++)
8010452c:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
80104530:	83 7d e4 0f          	cmpl   $0xf,-0x1c(%ebp)
80104534:	7e bd                	jle    801044f3 <fork+0xc8>
    if(proc->ofile[i])
      np->ofile[i] = filedup(proc->ofile[i]);
  np->cwd = idup(proc->cwd);
80104536:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010453c:	8b 40 68             	mov    0x68(%eax),%eax
8010453f:	89 04 24             	mov    %eax,(%esp)
80104542:	e8 ff d2 ff ff       	call   80101846 <idup>
80104547:	8b 55 e0             	mov    -0x20(%ebp),%edx
8010454a:	89 42 68             	mov    %eax,0x68(%edx)

  pid = np->pid;
8010454d:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104550:	8b 40 10             	mov    0x10(%eax),%eax
80104553:	89 45 dc             	mov    %eax,-0x24(%ebp)
  np->state = RUNNABLE;
80104556:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104559:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
  safestrcpy(np->name, proc->name, sizeof(proc->name));
80104560:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104566:	8d 50 6c             	lea    0x6c(%eax),%edx
80104569:	8b 45 e0             	mov    -0x20(%ebp),%eax
8010456c:	83 c0 6c             	add    $0x6c,%eax
8010456f:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
80104576:	00 
80104577:	89 54 24 04          	mov    %edx,0x4(%esp)
8010457b:	89 04 24             	mov    %eax,(%esp)
8010457e:	e8 47 0b 00 00       	call   801050ca <safestrcpy>

  //procdump();

  return pid;
80104583:	8b 45 dc             	mov    -0x24(%ebp),%eax
}
80104586:	83 c4 2c             	add    $0x2c,%esp
80104589:	5b                   	pop    %ebx
8010458a:	5e                   	pop    %esi
8010458b:	5f                   	pop    %edi
8010458c:	5d                   	pop    %ebp
8010458d:	c3                   	ret    

8010458e <exit>:
// Exit the current process.  Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void)
{
8010458e:	55                   	push   %ebp
8010458f:	89 e5                	mov    %esp,%ebp
80104591:	83 ec 28             	sub    $0x28,%esp
  struct proc *p;
  int fd;

  if(proc == initproc)
80104594:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
8010459b:	a1 48 c6 10 80       	mov    0x8010c648,%eax
801045a0:	39 c2                	cmp    %eax,%edx
801045a2:	75 0c                	jne    801045b0 <exit+0x22>
    panic("init exiting");
801045a4:	c7 04 24 23 8c 10 80 	movl   $0x80108c23,(%esp)
801045ab:	e8 a5 bf ff ff       	call   80100555 <panic>

  // Close all open files.
  for(fd = 0; fd < NOFILE; fd++){
801045b0:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
801045b7:	eb 44                	jmp    801045fd <exit+0x6f>
    if(proc->ofile[fd]){
801045b9:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801045bf:	8b 55 f0             	mov    -0x10(%ebp),%edx
801045c2:	83 c2 08             	add    $0x8,%edx
801045c5:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
801045c9:	85 c0                	test   %eax,%eax
801045cb:	74 2c                	je     801045f9 <exit+0x6b>
      fileclose(proc->ofile[fd]);
801045cd:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801045d3:	8b 55 f0             	mov    -0x10(%ebp),%edx
801045d6:	83 c2 08             	add    $0x8,%edx
801045d9:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
801045dd:	89 04 24             	mov    %eax,(%esp)
801045e0:	e8 ef c9 ff ff       	call   80100fd4 <fileclose>
      proc->ofile[fd] = 0;
801045e5:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801045eb:	8b 55 f0             	mov    -0x10(%ebp),%edx
801045ee:	83 c2 08             	add    $0x8,%edx
801045f1:	c7 44 90 08 00 00 00 	movl   $0x0,0x8(%eax,%edx,4)
801045f8:	00 

  if(proc == initproc)
    panic("init exiting");

  // Close all open files.
  for(fd = 0; fd < NOFILE; fd++){
801045f9:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
801045fd:	83 7d f0 0f          	cmpl   $0xf,-0x10(%ebp)
80104601:	7e b6                	jle    801045b9 <exit+0x2b>
      fileclose(proc->ofile[fd]);
      proc->ofile[fd] = 0;
    }
  }

  iput(proc->cwd);
80104603:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104609:	8b 40 68             	mov    0x68(%eax),%eax
8010460c:	89 04 24             	mov    %eax,(%esp)
8010460f:	e8 17 d4 ff ff       	call   80101a2b <iput>
  proc->cwd = 0;
80104614:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010461a:	c7 40 68 00 00 00 00 	movl   $0x0,0x68(%eax)

  acquire(&ptable.lock);
80104621:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
80104628:	e8 1e 06 00 00       	call   80104c4b <acquire>

  // Parent might be sleeping in wait().
  wakeup1(proc->parent);
8010462d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104633:	8b 40 14             	mov    0x14(%eax),%eax
80104636:	89 04 24             	mov    %eax,(%esp)
80104639:	e8 e6 03 00 00       	call   80104a24 <wakeup1>

  // Pass abandoned children to init.
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010463e:	c7 45 f4 74 0f 11 80 	movl   $0x80110f74,-0xc(%ebp)
80104645:	eb 38                	jmp    8010467f <exit+0xf1>
    if(p->parent == proc){
80104647:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010464a:	8b 50 14             	mov    0x14(%eax),%edx
8010464d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104653:	39 c2                	cmp    %eax,%edx
80104655:	75 24                	jne    8010467b <exit+0xed>
      p->parent = initproc;
80104657:	8b 15 48 c6 10 80    	mov    0x8010c648,%edx
8010465d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104660:	89 50 14             	mov    %edx,0x14(%eax)
      if(p->state == ZOMBIE)
80104663:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104666:	8b 40 0c             	mov    0xc(%eax),%eax
80104669:	83 f8 05             	cmp    $0x5,%eax
8010466c:	75 0d                	jne    8010467b <exit+0xed>
        wakeup1(initproc);
8010466e:	a1 48 c6 10 80       	mov    0x8010c648,%eax
80104673:	89 04 24             	mov    %eax,(%esp)
80104676:	e8 a9 03 00 00       	call   80104a24 <wakeup1>

  // Parent might be sleeping in wait().
  wakeup1(proc->parent);

  // Pass abandoned children to init.
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010467b:	83 45 f4 7c          	addl   $0x7c,-0xc(%ebp)
8010467f:	81 7d f4 74 2e 11 80 	cmpl   $0x80112e74,-0xc(%ebp)
80104686:	72 bf                	jb     80104647 <exit+0xb9>
        wakeup1(initproc);
    }
  }

  // Jump into the scheduler, never to return.
  proc->state = ZOMBIE;
80104688:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010468e:	c7 40 0c 05 00 00 00 	movl   $0x5,0xc(%eax)
  sched();
80104695:	e8 df 01 00 00       	call   80104879 <sched>
  panic("zombie exit");
8010469a:	c7 04 24 30 8c 10 80 	movl   $0x80108c30,(%esp)
801046a1:	e8 af be ff ff       	call   80100555 <panic>

801046a6 <wait>:

// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
801046a6:	55                   	push   %ebp
801046a7:	89 e5                	mov    %esp,%ebp
801046a9:	83 ec 28             	sub    $0x28,%esp
  struct proc *p;
  int havekids, pid;

  acquire(&ptable.lock);
801046ac:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
801046b3:	e8 93 05 00 00       	call   80104c4b <acquire>
  for(;;){
    // Scan through table looking for zombie children.
    havekids = 0;
801046b8:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801046bf:	c7 45 f4 74 0f 11 80 	movl   $0x80110f74,-0xc(%ebp)
801046c6:	e9 9a 00 00 00       	jmp    80104765 <wait+0xbf>
      if(p->parent != proc)
801046cb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046ce:	8b 50 14             	mov    0x14(%eax),%edx
801046d1:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801046d7:	39 c2                	cmp    %eax,%edx
801046d9:	0f 85 81 00 00 00    	jne    80104760 <wait+0xba>
        continue;
      havekids = 1;
801046df:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
      if(p->state == ZOMBIE){
801046e6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046e9:	8b 40 0c             	mov    0xc(%eax),%eax
801046ec:	83 f8 05             	cmp    $0x5,%eax
801046ef:	75 70                	jne    80104761 <wait+0xbb>
        // Found one.
        pid = p->pid;
801046f1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046f4:	8b 40 10             	mov    0x10(%eax),%eax
801046f7:	89 45 ec             	mov    %eax,-0x14(%ebp)
        kfree(p->kstack);
801046fa:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046fd:	8b 40 08             	mov    0x8(%eax),%eax
80104700:	89 04 24             	mov    %eax,(%esp)
80104703:	e8 70 e4 ff ff       	call   80102b78 <kfree>
        p->kstack = 0;
80104708:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010470b:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
        freevm(p->pgdir);
80104712:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104715:	8b 40 04             	mov    0x4(%eax),%eax
80104718:	89 04 24             	mov    %eax,(%esp)
8010471b:	e8 f9 38 00 00       	call   80108019 <freevm>
        p->state = UNUSED;
80104720:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104723:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
        p->pid = 0;
8010472a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010472d:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)
        p->parent = 0;
80104734:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104737:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
        p->name[0] = 0;
8010473e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104741:	c6 40 6c 00          	movb   $0x0,0x6c(%eax)
        p->killed = 0;
80104745:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104748:	c7 40 24 00 00 00 00 	movl   $0x0,0x24(%eax)
        release(&ptable.lock);
8010474f:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
80104756:	e8 52 05 00 00       	call   80104cad <release>
        return pid;
8010475b:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010475e:	eb 53                	jmp    801047b3 <wait+0x10d>
  for(;;){
    // Scan through table looking for zombie children.
    havekids = 0;
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
      if(p->parent != proc)
        continue;
80104760:	90                   	nop

  acquire(&ptable.lock);
  for(;;){
    // Scan through table looking for zombie children.
    havekids = 0;
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104761:	83 45 f4 7c          	addl   $0x7c,-0xc(%ebp)
80104765:	81 7d f4 74 2e 11 80 	cmpl   $0x80112e74,-0xc(%ebp)
8010476c:	0f 82 59 ff ff ff    	jb     801046cb <wait+0x25>
        return pid;
      }
    }

    // No point waiting if we don't have any children.
    if(!havekids || proc->killed){
80104772:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80104776:	74 0d                	je     80104785 <wait+0xdf>
80104778:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010477e:	8b 40 24             	mov    0x24(%eax),%eax
80104781:	85 c0                	test   %eax,%eax
80104783:	74 13                	je     80104798 <wait+0xf2>
      release(&ptable.lock);
80104785:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
8010478c:	e8 1c 05 00 00       	call   80104cad <release>
      return -1;
80104791:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104796:	eb 1b                	jmp    801047b3 <wait+0x10d>
    }

    // Wait for children to exit.  (See wakeup1 call in proc_exit.)
    sleep(proc, &ptable.lock);  //DOC: wait-sleep
80104798:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010479e:	c7 44 24 04 40 0f 11 	movl   $0x80110f40,0x4(%esp)
801047a5:	80 
801047a6:	89 04 24             	mov    %eax,(%esp)
801047a9:	e8 db 01 00 00       	call   80104989 <sleep>
  }
801047ae:	e9 05 ff ff ff       	jmp    801046b8 <wait+0x12>
}
801047b3:	c9                   	leave  
801047b4:	c3                   	ret    

801047b5 <scheduler>:
//  - swtch to start running that process
//  - eventually that process transfers control
//      via swtch back to the scheduler.
void
scheduler(void)
{
801047b5:	55                   	push   %ebp
801047b6:	89 e5                	mov    %esp,%ebp
801047b8:	83 ec 28             	sub    $0x28,%esp
  //uint *ptr;//, start_tick, last_tick;//, *pte;
// uint *pde;
  //uint count = 1;

  //last_i = 0;
  cprintf("[scheduler] ***** scheduler start ******\n");
801047bb:	c7 04 24 3c 8c 10 80 	movl   $0x80108c3c,(%esp)
801047c2:	e8 da bb ff ff       	call   801003a1 <cprintf>

  for(;;){
    // Enable interrupts on this processor.
    sti();
801047c7:	e8 79 f9 ff ff       	call   80104145 <sti>

    // Loop over process table looking for process to run.
    acquire(&ptable.lock);
801047cc:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
801047d3:	e8 73 04 00 00       	call   80104c4b <acquire>
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801047d8:	c7 45 f4 74 0f 11 80 	movl   $0x80110f74,-0xc(%ebp)
801047df:	eb 7a                	jmp    8010485b <scheduler+0xa6>
      if(p->state != RUNNABLE)
801047e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801047e4:	8b 40 0c             	mov    0xc(%eax),%eax
801047e7:	83 f8 03             	cmp    $0x3,%eax
801047ea:	75 6a                	jne    80104856 <scheduler+0xa1>
        continue;

      if(p->name[0] == 's' && p->name[1] == 'h') 
801047ec:	8b 45 f4             	mov    -0xc(%ebp),%eax
801047ef:	0f b6 40 6c          	movzbl 0x6c(%eax),%eax
801047f3:	3c 73                	cmp    $0x73,%al
801047f5:	75 10                	jne    80104807 <scheduler+0x52>
801047f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801047fa:	0f b6 40 6d          	movzbl 0x6d(%eax),%eax
801047fe:	3c 68                	cmp    $0x68,%al
80104800:	75 05                	jne    80104807 <scheduler+0x52>
      {
        // init swapper
        swapper_init();
80104802:	e8 22 40 00 00       	call   80108829 <swapper_init>
      }
      // Switch to chosen process.  It is the process's job
      // to release ptable.lock and then reacquire it
      // before jumping back to us.
      proc = p;
80104807:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010480a:	65 a3 04 00 00 00    	mov    %eax,%gs:0x4

      switchuvm(p);
80104810:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104813:	89 04 24             	mov    %eax,(%esp)
80104816:	e8 87 33 00 00       	call   80107ba2 <switchuvm>
      p->state = RUNNING;
8010481b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010481e:	c7 40 0c 04 00 00 00 	movl   $0x4,0xc(%eax)
      swtch(&cpu->scheduler, proc->context);
80104825:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010482b:	8b 40 1c             	mov    0x1c(%eax),%eax
8010482e:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
80104835:	83 c2 04             	add    $0x4,%edx
80104838:	89 44 24 04          	mov    %eax,0x4(%esp)
8010483c:	89 14 24             	mov    %edx,(%esp)
8010483f:	e8 fc 08 00 00       	call   80105140 <swtch>
      switchkvm();
80104844:	e8 3c 33 00 00       	call   80107b85 <switchkvm>
      //         // cprintf("\n");
      //     }
      // }
      // Process is done running for now.
      // It should have changed its p->state before coming back.
      proc = 0;
80104849:	65 c7 05 04 00 00 00 	movl   $0x0,%gs:0x4
80104850:	00 00 00 00 
80104854:	eb 01                	jmp    80104857 <scheduler+0xa2>

    // Loop over process table looking for process to run.
    acquire(&ptable.lock);
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
      if(p->state != RUNNABLE)
        continue;
80104856:	90                   	nop
    // Enable interrupts on this processor.
    sti();

    // Loop over process table looking for process to run.
    acquire(&ptable.lock);
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104857:	83 45 f4 7c          	addl   $0x7c,-0xc(%ebp)
8010485b:	81 7d f4 74 2e 11 80 	cmpl   $0x80112e74,-0xc(%ebp)
80104862:	0f 82 79 ff ff ff    	jb     801047e1 <scheduler+0x2c>
      // }
      // Process is done running for now.
      // It should have changed its p->state before coming back.
      proc = 0;
    }
    release(&ptable.lock);
80104868:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
8010486f:	e8 39 04 00 00       	call   80104cad <release>
    // {
    //     procdump();
    //     count = 0;
    // }
    // else count ++;
  }
80104874:	e9 4e ff ff ff       	jmp    801047c7 <scheduler+0x12>

80104879 <sched>:

// Enter scheduler.  Must hold only ptable.lock
// and have changed proc->state.
void
sched(void)
{
80104879:	55                   	push   %ebp
8010487a:	89 e5                	mov    %esp,%ebp
8010487c:	83 ec 28             	sub    $0x28,%esp
  int intena;

  if(!holding(&ptable.lock))
8010487f:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
80104886:	e8 de 04 00 00       	call   80104d69 <holding>
8010488b:	85 c0                	test   %eax,%eax
8010488d:	75 0c                	jne    8010489b <sched+0x22>
    panic("sched ptable.lock");
8010488f:	c7 04 24 66 8c 10 80 	movl   $0x80108c66,(%esp)
80104896:	e8 ba bc ff ff       	call   80100555 <panic>
  if(cpu->ncli != 1)
8010489b:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
801048a1:	8b 80 ac 00 00 00    	mov    0xac(%eax),%eax
801048a7:	83 f8 01             	cmp    $0x1,%eax
801048aa:	74 0c                	je     801048b8 <sched+0x3f>
    panic("sched locks");
801048ac:	c7 04 24 78 8c 10 80 	movl   $0x80108c78,(%esp)
801048b3:	e8 9d bc ff ff       	call   80100555 <panic>
  if(proc->state == RUNNING)
801048b8:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801048be:	8b 40 0c             	mov    0xc(%eax),%eax
801048c1:	83 f8 04             	cmp    $0x4,%eax
801048c4:	75 0c                	jne    801048d2 <sched+0x59>
    panic("sched running");
801048c6:	c7 04 24 84 8c 10 80 	movl   $0x80108c84,(%esp)
801048cd:	e8 83 bc ff ff       	call   80100555 <panic>
  if(readeflags()&FL_IF)
801048d2:	e8 59 f8 ff ff       	call   80104130 <readeflags>
801048d7:	25 00 02 00 00       	and    $0x200,%eax
801048dc:	85 c0                	test   %eax,%eax
801048de:	74 0c                	je     801048ec <sched+0x73>
    panic("sched interruptible");
801048e0:	c7 04 24 92 8c 10 80 	movl   $0x80108c92,(%esp)
801048e7:	e8 69 bc ff ff       	call   80100555 <panic>
  intena = cpu->intena;
801048ec:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
801048f2:	8b 80 b0 00 00 00    	mov    0xb0(%eax),%eax
801048f8:	89 45 f4             	mov    %eax,-0xc(%ebp)
  swtch(&proc->context, cpu->scheduler);
801048fb:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80104901:	8b 40 04             	mov    0x4(%eax),%eax
80104904:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
8010490b:	83 c2 1c             	add    $0x1c,%edx
8010490e:	89 44 24 04          	mov    %eax,0x4(%esp)
80104912:	89 14 24             	mov    %edx,(%esp)
80104915:	e8 26 08 00 00       	call   80105140 <swtch>
  cpu->intena = intena;
8010491a:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80104920:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104923:	89 90 b0 00 00 00    	mov    %edx,0xb0(%eax)
}
80104929:	c9                   	leave  
8010492a:	c3                   	ret    

8010492b <yield>:

// Give up the CPU for one scheduling round.
void
yield(void)
{
8010492b:	55                   	push   %ebp
8010492c:	89 e5                	mov    %esp,%ebp
8010492e:	83 ec 18             	sub    $0x18,%esp
  acquire(&ptable.lock);  //DOC: yieldlock
80104931:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
80104938:	e8 0e 03 00 00       	call   80104c4b <acquire>
  proc->state = RUNNABLE;
8010493d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104943:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
  sched();
8010494a:	e8 2a ff ff ff       	call   80104879 <sched>
  release(&ptable.lock);
8010494f:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
80104956:	e8 52 03 00 00       	call   80104cad <release>
}
8010495b:	c9                   	leave  
8010495c:	c3                   	ret    

8010495d <forkret>:

// A fork child's very first scheduling by scheduler()
// will swtch here.  "Return" to user space.
void
forkret(void)
{
8010495d:	55                   	push   %ebp
8010495e:	89 e5                	mov    %esp,%ebp
80104960:	83 ec 18             	sub    $0x18,%esp
  static int first = 1;
  // Still holding ptable.lock from scheduler.
  release(&ptable.lock);
80104963:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
8010496a:	e8 3e 03 00 00       	call   80104cad <release>

  if (first) {
8010496f:	a1 20 c0 10 80       	mov    0x8010c020,%eax
80104974:	85 c0                	test   %eax,%eax
80104976:	74 0f                	je     80104987 <forkret+0x2a>
    // Some initialization functions must be run in the context
    // of a regular process (e.g., they call sleep), and thus cannot
    // be run from main().
    first = 0;
80104978:	c7 05 20 c0 10 80 00 	movl   $0x0,0x8010c020
8010497f:	00 00 00 
    initlog();
80104982:	e8 9d e7 ff ff       	call   80103124 <initlog>
  }

  // Return to "caller", actually trapret (see allocproc).
}
80104987:	c9                   	leave  
80104988:	c3                   	ret    

80104989 <sleep>:

// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
80104989:	55                   	push   %ebp
8010498a:	89 e5                	mov    %esp,%ebp
8010498c:	83 ec 18             	sub    $0x18,%esp
  if(proc == 0)
8010498f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104995:	85 c0                	test   %eax,%eax
80104997:	75 0c                	jne    801049a5 <sleep+0x1c>
    panic("sleep");
80104999:	c7 04 24 a6 8c 10 80 	movl   $0x80108ca6,(%esp)
801049a0:	e8 b0 bb ff ff       	call   80100555 <panic>

  if(lk == 0)
801049a5:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
801049a9:	75 0c                	jne    801049b7 <sleep+0x2e>
    panic("sleep without lk");
801049ab:	c7 04 24 ac 8c 10 80 	movl   $0x80108cac,(%esp)
801049b2:	e8 9e bb ff ff       	call   80100555 <panic>
  // change p->state and then call sched.
  // Once we hold ptable.lock, we can be
  // guaranteed that we won't miss any wakeup
  // (wakeup runs with ptable.lock locked),
  // so it's okay to release lk.
  if(lk != &ptable.lock){  //DOC: sleeplock0
801049b7:	81 7d 0c 40 0f 11 80 	cmpl   $0x80110f40,0xc(%ebp)
801049be:	74 17                	je     801049d7 <sleep+0x4e>
    acquire(&ptable.lock);  //DOC: sleeplock1
801049c0:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
801049c7:	e8 7f 02 00 00       	call   80104c4b <acquire>
    release(lk);
801049cc:	8b 45 0c             	mov    0xc(%ebp),%eax
801049cf:	89 04 24             	mov    %eax,(%esp)
801049d2:	e8 d6 02 00 00       	call   80104cad <release>
  }

  // Go to sleep.
  proc->chan = chan;
801049d7:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801049dd:	8b 55 08             	mov    0x8(%ebp),%edx
801049e0:	89 50 20             	mov    %edx,0x20(%eax)
  proc->state = SLEEPING;
801049e3:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801049e9:	c7 40 0c 02 00 00 00 	movl   $0x2,0xc(%eax)
  sched();
801049f0:	e8 84 fe ff ff       	call   80104879 <sched>

  // Tidy up.
  proc->chan = 0;
801049f5:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801049fb:	c7 40 20 00 00 00 00 	movl   $0x0,0x20(%eax)

  // Reacquire original lock.
  if(lk != &ptable.lock){  //DOC: sleeplock2
80104a02:	81 7d 0c 40 0f 11 80 	cmpl   $0x80110f40,0xc(%ebp)
80104a09:	74 17                	je     80104a22 <sleep+0x99>
    release(&ptable.lock);
80104a0b:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
80104a12:	e8 96 02 00 00       	call   80104cad <release>
    acquire(lk);
80104a17:	8b 45 0c             	mov    0xc(%ebp),%eax
80104a1a:	89 04 24             	mov    %eax,(%esp)
80104a1d:	e8 29 02 00 00       	call   80104c4b <acquire>
  }
}
80104a22:	c9                   	leave  
80104a23:	c3                   	ret    

80104a24 <wakeup1>:
//PAGEBREAK!
// Wake up all processes sleeping on chan.
// The ptable lock must be held.
static void
wakeup1(void *chan)
{
80104a24:	55                   	push   %ebp
80104a25:	89 e5                	mov    %esp,%ebp
80104a27:	83 ec 10             	sub    $0x10,%esp
  struct proc *p;

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104a2a:	c7 45 fc 74 0f 11 80 	movl   $0x80110f74,-0x4(%ebp)
80104a31:	eb 24                	jmp    80104a57 <wakeup1+0x33>
    if(p->state == SLEEPING && p->chan == chan)
80104a33:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104a36:	8b 40 0c             	mov    0xc(%eax),%eax
80104a39:	83 f8 02             	cmp    $0x2,%eax
80104a3c:	75 15                	jne    80104a53 <wakeup1+0x2f>
80104a3e:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104a41:	8b 40 20             	mov    0x20(%eax),%eax
80104a44:	3b 45 08             	cmp    0x8(%ebp),%eax
80104a47:	75 0a                	jne    80104a53 <wakeup1+0x2f>
      p->state = RUNNABLE;
80104a49:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104a4c:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
static void
wakeup1(void *chan)
{
  struct proc *p;

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104a53:	83 45 fc 7c          	addl   $0x7c,-0x4(%ebp)
80104a57:	81 7d fc 74 2e 11 80 	cmpl   $0x80112e74,-0x4(%ebp)
80104a5e:	72 d3                	jb     80104a33 <wakeup1+0xf>
    if(p->state == SLEEPING && p->chan == chan)
      p->state = RUNNABLE;
}
80104a60:	c9                   	leave  
80104a61:	c3                   	ret    

80104a62 <wakeup>:

// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
80104a62:	55                   	push   %ebp
80104a63:	89 e5                	mov    %esp,%ebp
80104a65:	83 ec 18             	sub    $0x18,%esp
  acquire(&ptable.lock);
80104a68:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
80104a6f:	e8 d7 01 00 00       	call   80104c4b <acquire>
  wakeup1(chan);
80104a74:	8b 45 08             	mov    0x8(%ebp),%eax
80104a77:	89 04 24             	mov    %eax,(%esp)
80104a7a:	e8 a5 ff ff ff       	call   80104a24 <wakeup1>
  release(&ptable.lock);
80104a7f:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
80104a86:	e8 22 02 00 00       	call   80104cad <release>
}
80104a8b:	c9                   	leave  
80104a8c:	c3                   	ret    

80104a8d <kill>:
// Kill the process with the given pid.
// Process won't exit until it returns
// to user space (see trap in trap.c).
int
kill(int pid)
{
80104a8d:	55                   	push   %ebp
80104a8e:	89 e5                	mov    %esp,%ebp
80104a90:	83 ec 28             	sub    $0x28,%esp
  struct proc *p;

  acquire(&ptable.lock);
80104a93:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
80104a9a:	e8 ac 01 00 00       	call   80104c4b <acquire>
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104a9f:	c7 45 f4 74 0f 11 80 	movl   $0x80110f74,-0xc(%ebp)
80104aa6:	eb 41                	jmp    80104ae9 <kill+0x5c>
    if(p->pid == pid){
80104aa8:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104aab:	8b 40 10             	mov    0x10(%eax),%eax
80104aae:	3b 45 08             	cmp    0x8(%ebp),%eax
80104ab1:	75 32                	jne    80104ae5 <kill+0x58>
      p->killed = 1;
80104ab3:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104ab6:	c7 40 24 01 00 00 00 	movl   $0x1,0x24(%eax)
      // Wake process from sleep if necessary.
      if(p->state == SLEEPING)
80104abd:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104ac0:	8b 40 0c             	mov    0xc(%eax),%eax
80104ac3:	83 f8 02             	cmp    $0x2,%eax
80104ac6:	75 0a                	jne    80104ad2 <kill+0x45>
        p->state = RUNNABLE;
80104ac8:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104acb:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
      release(&ptable.lock);
80104ad2:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
80104ad9:	e8 cf 01 00 00       	call   80104cad <release>
      return 0;
80104ade:	b8 00 00 00 00       	mov    $0x0,%eax
80104ae3:	eb 1e                	jmp    80104b03 <kill+0x76>
kill(int pid)
{
  struct proc *p;

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104ae5:	83 45 f4 7c          	addl   $0x7c,-0xc(%ebp)
80104ae9:	81 7d f4 74 2e 11 80 	cmpl   $0x80112e74,-0xc(%ebp)
80104af0:	72 b6                	jb     80104aa8 <kill+0x1b>
        p->state = RUNNABLE;
      release(&ptable.lock);
      return 0;
    }
  }
  release(&ptable.lock);
80104af2:	c7 04 24 40 0f 11 80 	movl   $0x80110f40,(%esp)
80104af9:	e8 af 01 00 00       	call   80104cad <release>
  return -1;
80104afe:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80104b03:	c9                   	leave  
80104b04:	c3                   	ret    

80104b05 <procdump>:
// Print a process listing to console.  For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
{
80104b05:	55                   	push   %ebp
80104b06:	89 e5                	mov    %esp,%ebp
80104b08:	83 ec 38             	sub    $0x38,%esp
  //int i;
  struct proc *p;
  char *state;
  //uint pc[10];

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104b0b:	c7 45 f4 74 0f 11 80 	movl   $0x80110f74,-0xc(%ebp)
80104b12:	e9 87 00 00 00       	jmp    80104b9e <procdump+0x99>
    if(p->state == UNUSED)
80104b17:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b1a:	8b 40 0c             	mov    0xc(%eax),%eax
80104b1d:	85 c0                	test   %eax,%eax
80104b1f:	74 78                	je     80104b99 <procdump+0x94>
      continue;
    if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
80104b21:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b24:	8b 40 0c             	mov    0xc(%eax),%eax
80104b27:	83 f8 05             	cmp    $0x5,%eax
80104b2a:	77 23                	ja     80104b4f <procdump+0x4a>
80104b2c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b2f:	8b 40 0c             	mov    0xc(%eax),%eax
80104b32:	8b 04 85 08 c0 10 80 	mov    -0x7fef3ff8(,%eax,4),%eax
80104b39:	85 c0                	test   %eax,%eax
80104b3b:	74 12                	je     80104b4f <procdump+0x4a>
      state = states[p->state];
80104b3d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b40:	8b 40 0c             	mov    0xc(%eax),%eax
80104b43:	8b 04 85 08 c0 10 80 	mov    -0x7fef3ff8(,%eax,4),%eax
80104b4a:	89 45 f0             	mov    %eax,-0x10(%ebp)
80104b4d:	eb 07                	jmp    80104b56 <procdump+0x51>
    else
      state = "???";
80104b4f:	c7 45 f0 bd 8c 10 80 	movl   $0x80108cbd,-0x10(%ebp)
    cprintf("[procdump]\t%d %s %s\tsize=%d KBs", p->pid, state, p->name, p->sz / 1024);
80104b56:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b59:	8b 00                	mov    (%eax),%eax
80104b5b:	89 c1                	mov    %eax,%ecx
80104b5d:	c1 e9 0a             	shr    $0xa,%ecx
80104b60:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b63:	8d 50 6c             	lea    0x6c(%eax),%edx
80104b66:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b69:	8b 40 10             	mov    0x10(%eax),%eax
80104b6c:	89 4c 24 10          	mov    %ecx,0x10(%esp)
80104b70:	89 54 24 0c          	mov    %edx,0xc(%esp)
80104b74:	8b 55 f0             	mov    -0x10(%ebp),%edx
80104b77:	89 54 24 08          	mov    %edx,0x8(%esp)
80104b7b:	89 44 24 04          	mov    %eax,0x4(%esp)
80104b7f:	c7 04 24 c4 8c 10 80 	movl   $0x80108cc4,(%esp)
80104b86:	e8 16 b8 ff ff       	call   801003a1 <cprintf>
//    if(p->state == SLEEPING){
//      getcallerpcs((uint*)p->context->ebp+2, pc);
//      for(i=0; i<10 && pc[i] != 0; i++)
//        cprintf(" %p", pc[i]);
//    }
    cprintf("\n");
80104b8b:	c7 04 24 e4 8c 10 80 	movl   $0x80108ce4,(%esp)
80104b92:	e8 0a b8 ff ff       	call   801003a1 <cprintf>
80104b97:	eb 01                	jmp    80104b9a <procdump+0x95>
  char *state;
  //uint pc[10];

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
    if(p->state == UNUSED)
      continue;
80104b99:	90                   	nop
  //int i;
  struct proc *p;
  char *state;
  //uint pc[10];

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104b9a:	83 45 f4 7c          	addl   $0x7c,-0xc(%ebp)
80104b9e:	81 7d f4 74 2e 11 80 	cmpl   $0x80112e74,-0xc(%ebp)
80104ba5:	0f 82 6c ff ff ff    	jb     80104b17 <procdump+0x12>
//      for(i=0; i<10 && pc[i] != 0; i++)
//        cprintf(" %p", pc[i]);
//    }
    cprintf("\n");
  }
}
80104bab:	c9                   	leave  
80104bac:	c3                   	ret    

80104bad <get_pgdir>:

uint* get_pgdir(int pid)
{
80104bad:	55                   	push   %ebp
80104bae:	89 e5                	mov    %esp,%ebp
80104bb0:	83 ec 10             	sub    $0x10,%esp
    struct proc *p;
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104bb3:	c7 45 fc 74 0f 11 80 	movl   $0x80110f74,-0x4(%ebp)
80104bba:	eb 17                	jmp    80104bd3 <get_pgdir+0x26>
        if(p->pid == pid) return (uint*)p->pgdir;
80104bbc:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104bbf:	8b 40 10             	mov    0x10(%eax),%eax
80104bc2:	3b 45 08             	cmp    0x8(%ebp),%eax
80104bc5:	75 08                	jne    80104bcf <get_pgdir+0x22>
80104bc7:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104bca:	8b 40 04             	mov    0x4(%eax),%eax
80104bcd:	eb 12                	jmp    80104be1 <get_pgdir+0x34>
}

uint* get_pgdir(int pid)
{
    struct proc *p;
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104bcf:	83 45 fc 7c          	addl   $0x7c,-0x4(%ebp)
80104bd3:	81 7d fc 74 2e 11 80 	cmpl   $0x80112e74,-0x4(%ebp)
80104bda:	72 e0                	jb     80104bbc <get_pgdir+0xf>
        if(p->pid == pid) return (uint*)p->pgdir;
    return 0;
80104bdc:	b8 00 00 00 00       	mov    $0x0,%eax
}
80104be1:	c9                   	leave  
80104be2:	c3                   	ret    
	...

80104be4 <readeflags>:
  asm volatile("ltr %0" : : "r" (sel));
}

static inline uint
readeflags(void)
{
80104be4:	55                   	push   %ebp
80104be5:	89 e5                	mov    %esp,%ebp
80104be7:	53                   	push   %ebx
80104be8:	83 ec 10             	sub    $0x10,%esp
  uint eflags;
  asm volatile("pushfl; popl %0" : "=r" (eflags));
80104beb:	9c                   	pushf  
80104bec:	5b                   	pop    %ebx
80104bed:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  return eflags;
80104bf0:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80104bf3:	83 c4 10             	add    $0x10,%esp
80104bf6:	5b                   	pop    %ebx
80104bf7:	5d                   	pop    %ebp
80104bf8:	c3                   	ret    

80104bf9 <cli>:
  asm volatile("movw %0, %%gs" : : "r" (v));
}

static inline void
cli(void)
{
80104bf9:	55                   	push   %ebp
80104bfa:	89 e5                	mov    %esp,%ebp
  asm volatile("cli");
80104bfc:	fa                   	cli    
}
80104bfd:	5d                   	pop    %ebp
80104bfe:	c3                   	ret    

80104bff <sti>:

static inline void
sti(void)
{
80104bff:	55                   	push   %ebp
80104c00:	89 e5                	mov    %esp,%ebp
  asm volatile("sti");
80104c02:	fb                   	sti    
}
80104c03:	5d                   	pop    %ebp
80104c04:	c3                   	ret    

80104c05 <xchg>:

static inline uint
xchg(volatile uint *addr, uint newval)
{
80104c05:	55                   	push   %ebp
80104c06:	89 e5                	mov    %esp,%ebp
80104c08:	53                   	push   %ebx
80104c09:	83 ec 10             	sub    $0x10,%esp
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
               "+m" (*addr), "=a" (result) :
80104c0c:	8b 55 08             	mov    0x8(%ebp),%edx
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
80104c0f:	8b 45 0c             	mov    0xc(%ebp),%eax
               "+m" (*addr), "=a" (result) :
80104c12:	8b 4d 08             	mov    0x8(%ebp),%ecx
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
80104c15:	89 c3                	mov    %eax,%ebx
80104c17:	89 d8                	mov    %ebx,%eax
80104c19:	f0 87 02             	lock xchg %eax,(%edx)
80104c1c:	89 c3                	mov    %eax,%ebx
80104c1e:	89 5d f8             	mov    %ebx,-0x8(%ebp)
               "+m" (*addr), "=a" (result) :
               "1" (newval) :
               "cc");
  return result;
80104c21:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80104c24:	83 c4 10             	add    $0x10,%esp
80104c27:	5b                   	pop    %ebx
80104c28:	5d                   	pop    %ebp
80104c29:	c3                   	ret    

80104c2a <initlock>:
#include "proc.h"
#include "spinlock.h"

void
initlock(struct spinlock *lk, char *name)
{
80104c2a:	55                   	push   %ebp
80104c2b:	89 e5                	mov    %esp,%ebp
  lk->name = name;
80104c2d:	8b 45 08             	mov    0x8(%ebp),%eax
80104c30:	8b 55 0c             	mov    0xc(%ebp),%edx
80104c33:	89 50 04             	mov    %edx,0x4(%eax)
  lk->locked = 0;
80104c36:	8b 45 08             	mov    0x8(%ebp),%eax
80104c39:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
  lk->cpu = 0;
80104c3f:	8b 45 08             	mov    0x8(%ebp),%eax
80104c42:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
}
80104c49:	5d                   	pop    %ebp
80104c4a:	c3                   	ret    

80104c4b <acquire>:
// Loops (spins) until the lock is acquired.
// Holding a lock for a long time may cause
// other CPUs to waste time spinning to acquire it.
void
acquire(struct spinlock *lk)
{
80104c4b:	55                   	push   %ebp
80104c4c:	89 e5                	mov    %esp,%ebp
80104c4e:	83 ec 18             	sub    $0x18,%esp
  pushcli(); // disable interrupts to avoid deadlock.
80104c51:	e8 3d 01 00 00       	call   80104d93 <pushcli>
  if(holding(lk))
80104c56:	8b 45 08             	mov    0x8(%ebp),%eax
80104c59:	89 04 24             	mov    %eax,(%esp)
80104c5c:	e8 08 01 00 00       	call   80104d69 <holding>
80104c61:	85 c0                	test   %eax,%eax
80104c63:	74 0c                	je     80104c71 <acquire+0x26>
    panic("acquire");
80104c65:	c7 04 24 10 8d 10 80 	movl   $0x80108d10,(%esp)
80104c6c:	e8 e4 b8 ff ff       	call   80100555 <panic>

  // The xchg is atomic.
  // It also serializes, so that reads after acquire are not
  // reordered before it. 
  while(xchg(&lk->locked, 1) != 0)
80104c71:	90                   	nop
80104c72:	8b 45 08             	mov    0x8(%ebp),%eax
80104c75:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80104c7c:	00 
80104c7d:	89 04 24             	mov    %eax,(%esp)
80104c80:	e8 80 ff ff ff       	call   80104c05 <xchg>
80104c85:	85 c0                	test   %eax,%eax
80104c87:	75 e9                	jne    80104c72 <acquire+0x27>
    ;

  // Record info about lock acquisition for debugging.
  lk->cpu = cpu;
80104c89:	8b 45 08             	mov    0x8(%ebp),%eax
80104c8c:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
80104c93:	89 50 08             	mov    %edx,0x8(%eax)
  getcallerpcs(&lk, lk->pcs);
80104c96:	8b 45 08             	mov    0x8(%ebp),%eax
80104c99:	83 c0 0c             	add    $0xc,%eax
80104c9c:	89 44 24 04          	mov    %eax,0x4(%esp)
80104ca0:	8d 45 08             	lea    0x8(%ebp),%eax
80104ca3:	89 04 24             	mov    %eax,(%esp)
80104ca6:	e8 51 00 00 00       	call   80104cfc <getcallerpcs>
}
80104cab:	c9                   	leave  
80104cac:	c3                   	ret    

80104cad <release>:

// Release the lock.
void
release(struct spinlock *lk)
{
80104cad:	55                   	push   %ebp
80104cae:	89 e5                	mov    %esp,%ebp
80104cb0:	83 ec 18             	sub    $0x18,%esp
  if(!holding(lk))
80104cb3:	8b 45 08             	mov    0x8(%ebp),%eax
80104cb6:	89 04 24             	mov    %eax,(%esp)
80104cb9:	e8 ab 00 00 00       	call   80104d69 <holding>
80104cbe:	85 c0                	test   %eax,%eax
80104cc0:	75 0c                	jne    80104cce <release+0x21>
    panic("release");
80104cc2:	c7 04 24 18 8d 10 80 	movl   $0x80108d18,(%esp)
80104cc9:	e8 87 b8 ff ff       	call   80100555 <panic>

  lk->pcs[0] = 0;
80104cce:	8b 45 08             	mov    0x8(%ebp),%eax
80104cd1:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
  lk->cpu = 0;
80104cd8:	8b 45 08             	mov    0x8(%ebp),%eax
80104cdb:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
  // But the 2007 Intel 64 Architecture Memory Ordering White
  // Paper says that Intel 64 and IA-32 will not move a load
  // after a store. So lock->locked = 0 would work here.
  // The xchg being asm volatile ensures gcc emits it after
  // the above assignments (and after the critical section).
  xchg(&lk->locked, 0);
80104ce2:	8b 45 08             	mov    0x8(%ebp),%eax
80104ce5:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80104cec:	00 
80104ced:	89 04 24             	mov    %eax,(%esp)
80104cf0:	e8 10 ff ff ff       	call   80104c05 <xchg>

  popcli();
80104cf5:	e8 e1 00 00 00       	call   80104ddb <popcli>
}
80104cfa:	c9                   	leave  
80104cfb:	c3                   	ret    

80104cfc <getcallerpcs>:

// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
80104cfc:	55                   	push   %ebp
80104cfd:	89 e5                	mov    %esp,%ebp
80104cff:	83 ec 10             	sub    $0x10,%esp
  uint *ebp;
  int i;
  
  ebp = (uint*)v - 2;
80104d02:	8b 45 08             	mov    0x8(%ebp),%eax
80104d05:	83 e8 08             	sub    $0x8,%eax
80104d08:	89 45 fc             	mov    %eax,-0x4(%ebp)
  for(i = 0; i < 10; i++){
80104d0b:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
80104d12:	eb 32                	jmp    80104d46 <getcallerpcs+0x4a>
    if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
80104d14:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
80104d18:	74 47                	je     80104d61 <getcallerpcs+0x65>
80104d1a:	81 7d fc ff ff ff 7f 	cmpl   $0x7fffffff,-0x4(%ebp)
80104d21:	76 3e                	jbe    80104d61 <getcallerpcs+0x65>
80104d23:	83 7d fc ff          	cmpl   $0xffffffff,-0x4(%ebp)
80104d27:	74 38                	je     80104d61 <getcallerpcs+0x65>
      break;
    pcs[i] = ebp[1];     // saved %eip
80104d29:	8b 45 f8             	mov    -0x8(%ebp),%eax
80104d2c:	c1 e0 02             	shl    $0x2,%eax
80104d2f:	03 45 0c             	add    0xc(%ebp),%eax
80104d32:	8b 55 fc             	mov    -0x4(%ebp),%edx
80104d35:	8b 52 04             	mov    0x4(%edx),%edx
80104d38:	89 10                	mov    %edx,(%eax)
    ebp = (uint*)ebp[0]; // saved %ebp
80104d3a:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104d3d:	8b 00                	mov    (%eax),%eax
80104d3f:	89 45 fc             	mov    %eax,-0x4(%ebp)
{
  uint *ebp;
  int i;
  
  ebp = (uint*)v - 2;
  for(i = 0; i < 10; i++){
80104d42:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
80104d46:	83 7d f8 09          	cmpl   $0x9,-0x8(%ebp)
80104d4a:	7e c8                	jle    80104d14 <getcallerpcs+0x18>
    if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
      break;
    pcs[i] = ebp[1];     // saved %eip
    ebp = (uint*)ebp[0]; // saved %ebp
  }
  for(; i < 10; i++)
80104d4c:	eb 13                	jmp    80104d61 <getcallerpcs+0x65>
    pcs[i] = 0;
80104d4e:	8b 45 f8             	mov    -0x8(%ebp),%eax
80104d51:	c1 e0 02             	shl    $0x2,%eax
80104d54:	03 45 0c             	add    0xc(%ebp),%eax
80104d57:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
    if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
      break;
    pcs[i] = ebp[1];     // saved %eip
    ebp = (uint*)ebp[0]; // saved %ebp
  }
  for(; i < 10; i++)
80104d5d:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
80104d61:	83 7d f8 09          	cmpl   $0x9,-0x8(%ebp)
80104d65:	7e e7                	jle    80104d4e <getcallerpcs+0x52>
    pcs[i] = 0;
}
80104d67:	c9                   	leave  
80104d68:	c3                   	ret    

80104d69 <holding>:

// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
80104d69:	55                   	push   %ebp
80104d6a:	89 e5                	mov    %esp,%ebp
  return lock->locked && lock->cpu == cpu;
80104d6c:	8b 45 08             	mov    0x8(%ebp),%eax
80104d6f:	8b 00                	mov    (%eax),%eax
80104d71:	85 c0                	test   %eax,%eax
80104d73:	74 17                	je     80104d8c <holding+0x23>
80104d75:	8b 45 08             	mov    0x8(%ebp),%eax
80104d78:	8b 50 08             	mov    0x8(%eax),%edx
80104d7b:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80104d81:	39 c2                	cmp    %eax,%edx
80104d83:	75 07                	jne    80104d8c <holding+0x23>
80104d85:	b8 01 00 00 00       	mov    $0x1,%eax
80104d8a:	eb 05                	jmp    80104d91 <holding+0x28>
80104d8c:	b8 00 00 00 00       	mov    $0x0,%eax
}
80104d91:	5d                   	pop    %ebp
80104d92:	c3                   	ret    

80104d93 <pushcli>:
// it takes two popcli to undo two pushcli.  Also, if interrupts
// are off, then pushcli, popcli leaves them off.

void
pushcli(void)
{
80104d93:	55                   	push   %ebp
80104d94:	89 e5                	mov    %esp,%ebp
80104d96:	83 ec 10             	sub    $0x10,%esp
  int eflags;
  
  eflags = readeflags();
80104d99:	e8 46 fe ff ff       	call   80104be4 <readeflags>
80104d9e:	89 45 fc             	mov    %eax,-0x4(%ebp)
  cli();
80104da1:	e8 53 fe ff ff       	call   80104bf9 <cli>
  if(cpu->ncli++ == 0)
80104da6:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80104dac:	8b 90 ac 00 00 00    	mov    0xac(%eax),%edx
80104db2:	85 d2                	test   %edx,%edx
80104db4:	0f 94 c1             	sete   %cl
80104db7:	83 c2 01             	add    $0x1,%edx
80104dba:	89 90 ac 00 00 00    	mov    %edx,0xac(%eax)
80104dc0:	84 c9                	test   %cl,%cl
80104dc2:	74 15                	je     80104dd9 <pushcli+0x46>
    cpu->intena = eflags & FL_IF;
80104dc4:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80104dca:	8b 55 fc             	mov    -0x4(%ebp),%edx
80104dcd:	81 e2 00 02 00 00    	and    $0x200,%edx
80104dd3:	89 90 b0 00 00 00    	mov    %edx,0xb0(%eax)
}
80104dd9:	c9                   	leave  
80104dda:	c3                   	ret    

80104ddb <popcli>:

void
popcli(void)
{
80104ddb:	55                   	push   %ebp
80104ddc:	89 e5                	mov    %esp,%ebp
80104dde:	83 ec 18             	sub    $0x18,%esp
  if(readeflags()&FL_IF)
80104de1:	e8 fe fd ff ff       	call   80104be4 <readeflags>
80104de6:	25 00 02 00 00       	and    $0x200,%eax
80104deb:	85 c0                	test   %eax,%eax
80104ded:	74 0c                	je     80104dfb <popcli+0x20>
    panic("popcli - interruptible");
80104def:	c7 04 24 20 8d 10 80 	movl   $0x80108d20,(%esp)
80104df6:	e8 5a b7 ff ff       	call   80100555 <panic>
  if(--cpu->ncli < 0)
80104dfb:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80104e01:	8b 90 ac 00 00 00    	mov    0xac(%eax),%edx
80104e07:	83 ea 01             	sub    $0x1,%edx
80104e0a:	89 90 ac 00 00 00    	mov    %edx,0xac(%eax)
80104e10:	8b 80 ac 00 00 00    	mov    0xac(%eax),%eax
80104e16:	85 c0                	test   %eax,%eax
80104e18:	79 0c                	jns    80104e26 <popcli+0x4b>
    panic("popcli");
80104e1a:	c7 04 24 37 8d 10 80 	movl   $0x80108d37,(%esp)
80104e21:	e8 2f b7 ff ff       	call   80100555 <panic>
  if(cpu->ncli == 0 && cpu->intena)
80104e26:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80104e2c:	8b 80 ac 00 00 00    	mov    0xac(%eax),%eax
80104e32:	85 c0                	test   %eax,%eax
80104e34:	75 15                	jne    80104e4b <popcli+0x70>
80104e36:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80104e3c:	8b 80 b0 00 00 00    	mov    0xb0(%eax),%eax
80104e42:	85 c0                	test   %eax,%eax
80104e44:	74 05                	je     80104e4b <popcli+0x70>
    sti();
80104e46:	e8 b4 fd ff ff       	call   80104bff <sti>
}
80104e4b:	c9                   	leave  
80104e4c:	c3                   	ret    
80104e4d:	00 00                	add    %al,(%eax)
	...

80104e50 <stosb>:
               "cc");
}

static inline void
stosb(void *addr, int data, int cnt)
{
80104e50:	55                   	push   %ebp
80104e51:	89 e5                	mov    %esp,%ebp
80104e53:	57                   	push   %edi
80104e54:	53                   	push   %ebx
  asm volatile("cld; rep stosb" :
80104e55:	8b 4d 08             	mov    0x8(%ebp),%ecx
80104e58:	8b 55 10             	mov    0x10(%ebp),%edx
80104e5b:	8b 45 0c             	mov    0xc(%ebp),%eax
80104e5e:	89 cb                	mov    %ecx,%ebx
80104e60:	89 df                	mov    %ebx,%edi
80104e62:	89 d1                	mov    %edx,%ecx
80104e64:	fc                   	cld    
80104e65:	f3 aa                	rep stos %al,%es:(%edi)
80104e67:	89 ca                	mov    %ecx,%edx
80104e69:	89 fb                	mov    %edi,%ebx
80104e6b:	89 5d 08             	mov    %ebx,0x8(%ebp)
80104e6e:	89 55 10             	mov    %edx,0x10(%ebp)
               "=D" (addr), "=c" (cnt) :
               "0" (addr), "1" (cnt), "a" (data) :
               "memory", "cc");
}
80104e71:	5b                   	pop    %ebx
80104e72:	5f                   	pop    %edi
80104e73:	5d                   	pop    %ebp
80104e74:	c3                   	ret    

80104e75 <stosl>:

static inline void
stosl(void *addr, int data, int cnt)
{
80104e75:	55                   	push   %ebp
80104e76:	89 e5                	mov    %esp,%ebp
80104e78:	57                   	push   %edi
80104e79:	53                   	push   %ebx
  asm volatile("cld; rep stosl" :
80104e7a:	8b 4d 08             	mov    0x8(%ebp),%ecx
80104e7d:	8b 55 10             	mov    0x10(%ebp),%edx
80104e80:	8b 45 0c             	mov    0xc(%ebp),%eax
80104e83:	89 cb                	mov    %ecx,%ebx
80104e85:	89 df                	mov    %ebx,%edi
80104e87:	89 d1                	mov    %edx,%ecx
80104e89:	fc                   	cld    
80104e8a:	f3 ab                	rep stos %eax,%es:(%edi)
80104e8c:	89 ca                	mov    %ecx,%edx
80104e8e:	89 fb                	mov    %edi,%ebx
80104e90:	89 5d 08             	mov    %ebx,0x8(%ebp)
80104e93:	89 55 10             	mov    %edx,0x10(%ebp)
               "=D" (addr), "=c" (cnt) :
               "0" (addr), "1" (cnt), "a" (data) :
               "memory", "cc");
}
80104e96:	5b                   	pop    %ebx
80104e97:	5f                   	pop    %edi
80104e98:	5d                   	pop    %ebp
80104e99:	c3                   	ret    

80104e9a <memset>:
#include "types.h"
#include "x86.h"

void*
memset(void *dst, int c, uint n)
{
80104e9a:	55                   	push   %ebp
80104e9b:	89 e5                	mov    %esp,%ebp
80104e9d:	83 ec 0c             	sub    $0xc,%esp
  if ((int)dst%4 == 0 && n%4 == 0){
80104ea0:	8b 45 08             	mov    0x8(%ebp),%eax
80104ea3:	83 e0 03             	and    $0x3,%eax
80104ea6:	85 c0                	test   %eax,%eax
80104ea8:	75 49                	jne    80104ef3 <memset+0x59>
80104eaa:	8b 45 10             	mov    0x10(%ebp),%eax
80104ead:	83 e0 03             	and    $0x3,%eax
80104eb0:	85 c0                	test   %eax,%eax
80104eb2:	75 3f                	jne    80104ef3 <memset+0x59>
    c &= 0xFF;
80104eb4:	81 65 0c ff 00 00 00 	andl   $0xff,0xc(%ebp)
    stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);
80104ebb:	8b 45 10             	mov    0x10(%ebp),%eax
80104ebe:	c1 e8 02             	shr    $0x2,%eax
80104ec1:	89 c2                	mov    %eax,%edx
80104ec3:	8b 45 0c             	mov    0xc(%ebp),%eax
80104ec6:	89 c1                	mov    %eax,%ecx
80104ec8:	c1 e1 18             	shl    $0x18,%ecx
80104ecb:	8b 45 0c             	mov    0xc(%ebp),%eax
80104ece:	c1 e0 10             	shl    $0x10,%eax
80104ed1:	09 c1                	or     %eax,%ecx
80104ed3:	8b 45 0c             	mov    0xc(%ebp),%eax
80104ed6:	c1 e0 08             	shl    $0x8,%eax
80104ed9:	09 c8                	or     %ecx,%eax
80104edb:	0b 45 0c             	or     0xc(%ebp),%eax
80104ede:	89 54 24 08          	mov    %edx,0x8(%esp)
80104ee2:	89 44 24 04          	mov    %eax,0x4(%esp)
80104ee6:	8b 45 08             	mov    0x8(%ebp),%eax
80104ee9:	89 04 24             	mov    %eax,(%esp)
80104eec:	e8 84 ff ff ff       	call   80104e75 <stosl>
80104ef1:	eb 19                	jmp    80104f0c <memset+0x72>
  } else
    stosb(dst, c, n);
80104ef3:	8b 45 10             	mov    0x10(%ebp),%eax
80104ef6:	89 44 24 08          	mov    %eax,0x8(%esp)
80104efa:	8b 45 0c             	mov    0xc(%ebp),%eax
80104efd:	89 44 24 04          	mov    %eax,0x4(%esp)
80104f01:	8b 45 08             	mov    0x8(%ebp),%eax
80104f04:	89 04 24             	mov    %eax,(%esp)
80104f07:	e8 44 ff ff ff       	call   80104e50 <stosb>
  return dst;
80104f0c:	8b 45 08             	mov    0x8(%ebp),%eax
}
80104f0f:	c9                   	leave  
80104f10:	c3                   	ret    

80104f11 <memcmp>:

int
memcmp(const void *v1, const void *v2, uint n)
{
80104f11:	55                   	push   %ebp
80104f12:	89 e5                	mov    %esp,%ebp
80104f14:	83 ec 10             	sub    $0x10,%esp
  const uchar *s1, *s2;
  
  s1 = v1;
80104f17:	8b 45 08             	mov    0x8(%ebp),%eax
80104f1a:	89 45 fc             	mov    %eax,-0x4(%ebp)
  s2 = v2;
80104f1d:	8b 45 0c             	mov    0xc(%ebp),%eax
80104f20:	89 45 f8             	mov    %eax,-0x8(%ebp)
  while(n-- > 0){
80104f23:	eb 32                	jmp    80104f57 <memcmp+0x46>
    if(*s1 != *s2)
80104f25:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104f28:	0f b6 10             	movzbl (%eax),%edx
80104f2b:	8b 45 f8             	mov    -0x8(%ebp),%eax
80104f2e:	0f b6 00             	movzbl (%eax),%eax
80104f31:	38 c2                	cmp    %al,%dl
80104f33:	74 1a                	je     80104f4f <memcmp+0x3e>
      return *s1 - *s2;
80104f35:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104f38:	0f b6 00             	movzbl (%eax),%eax
80104f3b:	0f b6 d0             	movzbl %al,%edx
80104f3e:	8b 45 f8             	mov    -0x8(%ebp),%eax
80104f41:	0f b6 00             	movzbl (%eax),%eax
80104f44:	0f b6 c0             	movzbl %al,%eax
80104f47:	89 d1                	mov    %edx,%ecx
80104f49:	29 c1                	sub    %eax,%ecx
80104f4b:	89 c8                	mov    %ecx,%eax
80104f4d:	eb 1c                	jmp    80104f6b <memcmp+0x5a>
    s1++, s2++;
80104f4f:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80104f53:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
{
  const uchar *s1, *s2;
  
  s1 = v1;
  s2 = v2;
  while(n-- > 0){
80104f57:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80104f5b:	0f 95 c0             	setne  %al
80104f5e:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
80104f62:	84 c0                	test   %al,%al
80104f64:	75 bf                	jne    80104f25 <memcmp+0x14>
    if(*s1 != *s2)
      return *s1 - *s2;
    s1++, s2++;
  }

  return 0;
80104f66:	b8 00 00 00 00       	mov    $0x0,%eax
}
80104f6b:	c9                   	leave  
80104f6c:	c3                   	ret    

80104f6d <memmove>:

void*
memmove(void *dst, const void *src, uint n)
{
80104f6d:	55                   	push   %ebp
80104f6e:	89 e5                	mov    %esp,%ebp
80104f70:	83 ec 10             	sub    $0x10,%esp
  const char *s;
  char *d;

  s = src;
80104f73:	8b 45 0c             	mov    0xc(%ebp),%eax
80104f76:	89 45 fc             	mov    %eax,-0x4(%ebp)
  d = dst;
80104f79:	8b 45 08             	mov    0x8(%ebp),%eax
80104f7c:	89 45 f8             	mov    %eax,-0x8(%ebp)
  if(s < d && s + n > d){
80104f7f:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104f82:	3b 45 f8             	cmp    -0x8(%ebp),%eax
80104f85:	73 54                	jae    80104fdb <memmove+0x6e>
80104f87:	8b 45 10             	mov    0x10(%ebp),%eax
80104f8a:	8b 55 fc             	mov    -0x4(%ebp),%edx
80104f8d:	01 d0                	add    %edx,%eax
80104f8f:	3b 45 f8             	cmp    -0x8(%ebp),%eax
80104f92:	76 47                	jbe    80104fdb <memmove+0x6e>
    s += n;
80104f94:	8b 45 10             	mov    0x10(%ebp),%eax
80104f97:	01 45 fc             	add    %eax,-0x4(%ebp)
    d += n;
80104f9a:	8b 45 10             	mov    0x10(%ebp),%eax
80104f9d:	01 45 f8             	add    %eax,-0x8(%ebp)
    while(n-- > 0)
80104fa0:	eb 13                	jmp    80104fb5 <memmove+0x48>
      *--d = *--s;
80104fa2:	83 6d f8 01          	subl   $0x1,-0x8(%ebp)
80104fa6:	83 6d fc 01          	subl   $0x1,-0x4(%ebp)
80104faa:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104fad:	0f b6 10             	movzbl (%eax),%edx
80104fb0:	8b 45 f8             	mov    -0x8(%ebp),%eax
80104fb3:	88 10                	mov    %dl,(%eax)
  s = src;
  d = dst;
  if(s < d && s + n > d){
    s += n;
    d += n;
    while(n-- > 0)
80104fb5:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80104fb9:	0f 95 c0             	setne  %al
80104fbc:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
80104fc0:	84 c0                	test   %al,%al
80104fc2:	75 de                	jne    80104fa2 <memmove+0x35>
  const char *s;
  char *d;

  s = src;
  d = dst;
  if(s < d && s + n > d){
80104fc4:	eb 25                	jmp    80104feb <memmove+0x7e>
    d += n;
    while(n-- > 0)
      *--d = *--s;
  } else
    while(n-- > 0)
      *d++ = *s++;
80104fc6:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104fc9:	0f b6 10             	movzbl (%eax),%edx
80104fcc:	8b 45 f8             	mov    -0x8(%ebp),%eax
80104fcf:	88 10                	mov    %dl,(%eax)
80104fd1:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
80104fd5:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80104fd9:	eb 01                	jmp    80104fdc <memmove+0x6f>
    s += n;
    d += n;
    while(n-- > 0)
      *--d = *--s;
  } else
    while(n-- > 0)
80104fdb:	90                   	nop
80104fdc:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80104fe0:	0f 95 c0             	setne  %al
80104fe3:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
80104fe7:	84 c0                	test   %al,%al
80104fe9:	75 db                	jne    80104fc6 <memmove+0x59>
      *d++ = *s++;

  return dst;
80104feb:	8b 45 08             	mov    0x8(%ebp),%eax
}
80104fee:	c9                   	leave  
80104fef:	c3                   	ret    

80104ff0 <memcpy>:

// memcpy exists to placate GCC.  Use memmove.
void*
memcpy(void *dst, const void *src, uint n)
{
80104ff0:	55                   	push   %ebp
80104ff1:	89 e5                	mov    %esp,%ebp
80104ff3:	83 ec 0c             	sub    $0xc,%esp
  return memmove(dst, src, n);
80104ff6:	8b 45 10             	mov    0x10(%ebp),%eax
80104ff9:	89 44 24 08          	mov    %eax,0x8(%esp)
80104ffd:	8b 45 0c             	mov    0xc(%ebp),%eax
80105000:	89 44 24 04          	mov    %eax,0x4(%esp)
80105004:	8b 45 08             	mov    0x8(%ebp),%eax
80105007:	89 04 24             	mov    %eax,(%esp)
8010500a:	e8 5e ff ff ff       	call   80104f6d <memmove>
}
8010500f:	c9                   	leave  
80105010:	c3                   	ret    

80105011 <strncmp>:

int
strncmp(const char *p, const char *q, uint n)
{
80105011:	55                   	push   %ebp
80105012:	89 e5                	mov    %esp,%ebp
  while(n > 0 && *p && *p == *q)
80105014:	eb 0c                	jmp    80105022 <strncmp+0x11>
    n--, p++, q++;
80105016:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
8010501a:	83 45 08 01          	addl   $0x1,0x8(%ebp)
8010501e:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
}

int
strncmp(const char *p, const char *q, uint n)
{
  while(n > 0 && *p && *p == *q)
80105022:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80105026:	74 1a                	je     80105042 <strncmp+0x31>
80105028:	8b 45 08             	mov    0x8(%ebp),%eax
8010502b:	0f b6 00             	movzbl (%eax),%eax
8010502e:	84 c0                	test   %al,%al
80105030:	74 10                	je     80105042 <strncmp+0x31>
80105032:	8b 45 08             	mov    0x8(%ebp),%eax
80105035:	0f b6 10             	movzbl (%eax),%edx
80105038:	8b 45 0c             	mov    0xc(%ebp),%eax
8010503b:	0f b6 00             	movzbl (%eax),%eax
8010503e:	38 c2                	cmp    %al,%dl
80105040:	74 d4                	je     80105016 <strncmp+0x5>
    n--, p++, q++;
  if(n == 0)
80105042:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80105046:	75 07                	jne    8010504f <strncmp+0x3e>
    return 0;
80105048:	b8 00 00 00 00       	mov    $0x0,%eax
8010504d:	eb 18                	jmp    80105067 <strncmp+0x56>
  return (uchar)*p - (uchar)*q;
8010504f:	8b 45 08             	mov    0x8(%ebp),%eax
80105052:	0f b6 00             	movzbl (%eax),%eax
80105055:	0f b6 d0             	movzbl %al,%edx
80105058:	8b 45 0c             	mov    0xc(%ebp),%eax
8010505b:	0f b6 00             	movzbl (%eax),%eax
8010505e:	0f b6 c0             	movzbl %al,%eax
80105061:	89 d1                	mov    %edx,%ecx
80105063:	29 c1                	sub    %eax,%ecx
80105065:	89 c8                	mov    %ecx,%eax
}
80105067:	5d                   	pop    %ebp
80105068:	c3                   	ret    

80105069 <strncpy>:

char*
strncpy(char *s, const char *t, int n)
{
80105069:	55                   	push   %ebp
8010506a:	89 e5                	mov    %esp,%ebp
8010506c:	83 ec 10             	sub    $0x10,%esp
  char *os;
  
  os = s;
8010506f:	8b 45 08             	mov    0x8(%ebp),%eax
80105072:	89 45 fc             	mov    %eax,-0x4(%ebp)
  while(n-- > 0 && (*s++ = *t++) != 0)
80105075:	90                   	nop
80105076:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
8010507a:	0f 9f c0             	setg   %al
8010507d:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
80105081:	84 c0                	test   %al,%al
80105083:	74 30                	je     801050b5 <strncpy+0x4c>
80105085:	8b 45 0c             	mov    0xc(%ebp),%eax
80105088:	0f b6 10             	movzbl (%eax),%edx
8010508b:	8b 45 08             	mov    0x8(%ebp),%eax
8010508e:	88 10                	mov    %dl,(%eax)
80105090:	8b 45 08             	mov    0x8(%ebp),%eax
80105093:	0f b6 00             	movzbl (%eax),%eax
80105096:	84 c0                	test   %al,%al
80105098:	0f 95 c0             	setne  %al
8010509b:	83 45 08 01          	addl   $0x1,0x8(%ebp)
8010509f:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
801050a3:	84 c0                	test   %al,%al
801050a5:	75 cf                	jne    80105076 <strncpy+0xd>
    ;
  while(n-- > 0)
801050a7:	eb 0c                	jmp    801050b5 <strncpy+0x4c>
    *s++ = 0;
801050a9:	8b 45 08             	mov    0x8(%ebp),%eax
801050ac:	c6 00 00             	movb   $0x0,(%eax)
801050af:	83 45 08 01          	addl   $0x1,0x8(%ebp)
801050b3:	eb 01                	jmp    801050b6 <strncpy+0x4d>
  char *os;
  
  os = s;
  while(n-- > 0 && (*s++ = *t++) != 0)
    ;
  while(n-- > 0)
801050b5:	90                   	nop
801050b6:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801050ba:	0f 9f c0             	setg   %al
801050bd:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
801050c1:	84 c0                	test   %al,%al
801050c3:	75 e4                	jne    801050a9 <strncpy+0x40>
    *s++ = 0;
  return os;
801050c5:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
801050c8:	c9                   	leave  
801050c9:	c3                   	ret    

801050ca <safestrcpy>:

// Like strncpy but guaranteed to NUL-terminate.
char*
safestrcpy(char *s, const char *t, int n)
{
801050ca:	55                   	push   %ebp
801050cb:	89 e5                	mov    %esp,%ebp
801050cd:	83 ec 10             	sub    $0x10,%esp
  char *os;
  
  os = s;
801050d0:	8b 45 08             	mov    0x8(%ebp),%eax
801050d3:	89 45 fc             	mov    %eax,-0x4(%ebp)
  if(n <= 0)
801050d6:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801050da:	7f 05                	jg     801050e1 <safestrcpy+0x17>
    return os;
801050dc:	8b 45 fc             	mov    -0x4(%ebp),%eax
801050df:	eb 35                	jmp    80105116 <safestrcpy+0x4c>
  while(--n > 0 && (*s++ = *t++) != 0)
801050e1:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
801050e5:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801050e9:	7e 22                	jle    8010510d <safestrcpy+0x43>
801050eb:	8b 45 0c             	mov    0xc(%ebp),%eax
801050ee:	0f b6 10             	movzbl (%eax),%edx
801050f1:	8b 45 08             	mov    0x8(%ebp),%eax
801050f4:	88 10                	mov    %dl,(%eax)
801050f6:	8b 45 08             	mov    0x8(%ebp),%eax
801050f9:	0f b6 00             	movzbl (%eax),%eax
801050fc:	84 c0                	test   %al,%al
801050fe:	0f 95 c0             	setne  %al
80105101:	83 45 08 01          	addl   $0x1,0x8(%ebp)
80105105:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
80105109:	84 c0                	test   %al,%al
8010510b:	75 d4                	jne    801050e1 <safestrcpy+0x17>
    ;
  *s = 0;
8010510d:	8b 45 08             	mov    0x8(%ebp),%eax
80105110:	c6 00 00             	movb   $0x0,(%eax)
  return os;
80105113:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
80105116:	c9                   	leave  
80105117:	c3                   	ret    

80105118 <strlen>:

int
strlen(const char *s)
{
80105118:	55                   	push   %ebp
80105119:	89 e5                	mov    %esp,%ebp
8010511b:	83 ec 10             	sub    $0x10,%esp
  int n;

  for(n = 0; s[n]; n++)
8010511e:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
80105125:	eb 04                	jmp    8010512b <strlen+0x13>
80105127:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
8010512b:	8b 45 fc             	mov    -0x4(%ebp),%eax
8010512e:	03 45 08             	add    0x8(%ebp),%eax
80105131:	0f b6 00             	movzbl (%eax),%eax
80105134:	84 c0                	test   %al,%al
80105136:	75 ef                	jne    80105127 <strlen+0xf>
    ;
  return n;
80105138:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
8010513b:	c9                   	leave  
8010513c:	c3                   	ret    
8010513d:	00 00                	add    %al,(%eax)
	...

80105140 <swtch>:
# Save current register context in old
# and then load register context from new.

.globl swtch
swtch:
  movl 4(%esp), %eax
80105140:	8b 44 24 04          	mov    0x4(%esp),%eax
  movl 8(%esp), %edx
80105144:	8b 54 24 08          	mov    0x8(%esp),%edx

  # Save old callee-save registers
  pushl %ebp
80105148:	55                   	push   %ebp
  pushl %ebx
80105149:	53                   	push   %ebx
  pushl %esi
8010514a:	56                   	push   %esi
  pushl %edi
8010514b:	57                   	push   %edi

  # Switch stacks
  movl %esp, (%eax)
8010514c:	89 20                	mov    %esp,(%eax)
  movl %edx, %esp
8010514e:	89 d4                	mov    %edx,%esp

  # Load new callee-save registers
  popl %edi
80105150:	5f                   	pop    %edi
  popl %esi
80105151:	5e                   	pop    %esi
  popl %ebx
80105152:	5b                   	pop    %ebx
  popl %ebp
80105153:	5d                   	pop    %ebp
  ret
80105154:	c3                   	ret    
80105155:	00 00                	add    %al,(%eax)
	...

80105158 <fetchint>:
// to a saved program counter, and then the first argument.

// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
80105158:	55                   	push   %ebp
80105159:	89 e5                	mov    %esp,%ebp
  if(addr >= proc->sz || addr+4 > proc->sz)
8010515b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105161:	8b 00                	mov    (%eax),%eax
80105163:	3b 45 08             	cmp    0x8(%ebp),%eax
80105166:	76 12                	jbe    8010517a <fetchint+0x22>
80105168:	8b 45 08             	mov    0x8(%ebp),%eax
8010516b:	8d 50 04             	lea    0x4(%eax),%edx
8010516e:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105174:	8b 00                	mov    (%eax),%eax
80105176:	39 c2                	cmp    %eax,%edx
80105178:	76 07                	jbe    80105181 <fetchint+0x29>
    return -1;
8010517a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010517f:	eb 0f                	jmp    80105190 <fetchint+0x38>
  *ip = *(int*)(addr);
80105181:	8b 45 08             	mov    0x8(%ebp),%eax
80105184:	8b 10                	mov    (%eax),%edx
80105186:	8b 45 0c             	mov    0xc(%ebp),%eax
80105189:	89 10                	mov    %edx,(%eax)
  return 0;
8010518b:	b8 00 00 00 00       	mov    $0x0,%eax
}
80105190:	5d                   	pop    %ebp
80105191:	c3                   	ret    

80105192 <fetchstr>:
// Fetch the nul-terminated string at addr from the current process.
// Doesn't actually copy the string - just sets *pp to point at it.
// Returns length of string, not including nul.
int
fetchstr(uint addr, char **pp)
{
80105192:	55                   	push   %ebp
80105193:	89 e5                	mov    %esp,%ebp
80105195:	83 ec 10             	sub    $0x10,%esp
  char *s, *ep;

  if(addr >= proc->sz)
80105198:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010519e:	8b 00                	mov    (%eax),%eax
801051a0:	3b 45 08             	cmp    0x8(%ebp),%eax
801051a3:	77 07                	ja     801051ac <fetchstr+0x1a>
    return -1;
801051a5:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801051aa:	eb 48                	jmp    801051f4 <fetchstr+0x62>
  *pp = (char*)addr;
801051ac:	8b 55 08             	mov    0x8(%ebp),%edx
801051af:	8b 45 0c             	mov    0xc(%ebp),%eax
801051b2:	89 10                	mov    %edx,(%eax)
  ep = (char*)proc->sz;
801051b4:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801051ba:	8b 00                	mov    (%eax),%eax
801051bc:	89 45 f8             	mov    %eax,-0x8(%ebp)
  for(s = *pp; s < ep; s++)
801051bf:	8b 45 0c             	mov    0xc(%ebp),%eax
801051c2:	8b 00                	mov    (%eax),%eax
801051c4:	89 45 fc             	mov    %eax,-0x4(%ebp)
801051c7:	eb 1e                	jmp    801051e7 <fetchstr+0x55>
    if(*s == 0)
801051c9:	8b 45 fc             	mov    -0x4(%ebp),%eax
801051cc:	0f b6 00             	movzbl (%eax),%eax
801051cf:	84 c0                	test   %al,%al
801051d1:	75 10                	jne    801051e3 <fetchstr+0x51>
      return s - *pp;
801051d3:	8b 55 fc             	mov    -0x4(%ebp),%edx
801051d6:	8b 45 0c             	mov    0xc(%ebp),%eax
801051d9:	8b 00                	mov    (%eax),%eax
801051db:	89 d1                	mov    %edx,%ecx
801051dd:	29 c1                	sub    %eax,%ecx
801051df:	89 c8                	mov    %ecx,%eax
801051e1:	eb 11                	jmp    801051f4 <fetchstr+0x62>

  if(addr >= proc->sz)
    return -1;
  *pp = (char*)addr;
  ep = (char*)proc->sz;
  for(s = *pp; s < ep; s++)
801051e3:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
801051e7:	8b 45 fc             	mov    -0x4(%ebp),%eax
801051ea:	3b 45 f8             	cmp    -0x8(%ebp),%eax
801051ed:	72 da                	jb     801051c9 <fetchstr+0x37>
    if(*s == 0)
      return s - *pp;
  return -1;
801051ef:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
801051f4:	c9                   	leave  
801051f5:	c3                   	ret    

801051f6 <argint>:

// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
801051f6:	55                   	push   %ebp
801051f7:	89 e5                	mov    %esp,%ebp
801051f9:	83 ec 08             	sub    $0x8,%esp
  return fetchint(proc->tf->esp + 4 + 4*n, ip);
801051fc:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105202:	8b 40 18             	mov    0x18(%eax),%eax
80105205:	8b 50 44             	mov    0x44(%eax),%edx
80105208:	8b 45 08             	mov    0x8(%ebp),%eax
8010520b:	c1 e0 02             	shl    $0x2,%eax
8010520e:	01 d0                	add    %edx,%eax
80105210:	8d 50 04             	lea    0x4(%eax),%edx
80105213:	8b 45 0c             	mov    0xc(%ebp),%eax
80105216:	89 44 24 04          	mov    %eax,0x4(%esp)
8010521a:	89 14 24             	mov    %edx,(%esp)
8010521d:	e8 36 ff ff ff       	call   80105158 <fetchint>
}
80105222:	c9                   	leave  
80105223:	c3                   	ret    

80105224 <argptr>:
// Fetch the nth word-sized system call argument as a pointer
// to a block of memory of size n bytes.  Check that the pointer
// lies within the process address space.
int
argptr(int n, char **pp, int size)
{
80105224:	55                   	push   %ebp
80105225:	89 e5                	mov    %esp,%ebp
80105227:	83 ec 18             	sub    $0x18,%esp
  int i;

  if(argint(n, &i) < 0)
8010522a:	8d 45 fc             	lea    -0x4(%ebp),%eax
8010522d:	89 44 24 04          	mov    %eax,0x4(%esp)
80105231:	8b 45 08             	mov    0x8(%ebp),%eax
80105234:	89 04 24             	mov    %eax,(%esp)
80105237:	e8 ba ff ff ff       	call   801051f6 <argint>
8010523c:	85 c0                	test   %eax,%eax
8010523e:	79 07                	jns    80105247 <argptr+0x23>
    return -1;
80105240:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105245:	eb 3d                	jmp    80105284 <argptr+0x60>
  if((uint)i >= proc->sz || (uint)i+size > proc->sz)
80105247:	8b 45 fc             	mov    -0x4(%ebp),%eax
8010524a:	89 c2                	mov    %eax,%edx
8010524c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105252:	8b 00                	mov    (%eax),%eax
80105254:	39 c2                	cmp    %eax,%edx
80105256:	73 16                	jae    8010526e <argptr+0x4a>
80105258:	8b 45 fc             	mov    -0x4(%ebp),%eax
8010525b:	89 c2                	mov    %eax,%edx
8010525d:	8b 45 10             	mov    0x10(%ebp),%eax
80105260:	01 c2                	add    %eax,%edx
80105262:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105268:	8b 00                	mov    (%eax),%eax
8010526a:	39 c2                	cmp    %eax,%edx
8010526c:	76 07                	jbe    80105275 <argptr+0x51>
    return -1;
8010526e:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105273:	eb 0f                	jmp    80105284 <argptr+0x60>
  *pp = (char*)i;
80105275:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105278:	89 c2                	mov    %eax,%edx
8010527a:	8b 45 0c             	mov    0xc(%ebp),%eax
8010527d:	89 10                	mov    %edx,(%eax)
  return 0;
8010527f:	b8 00 00 00 00       	mov    $0x0,%eax
}
80105284:	c9                   	leave  
80105285:	c3                   	ret    

80105286 <argstr>:
// Check that the pointer is valid and the string is nul-terminated.
// (There is no shared writable memory, so the string can't change
// between this check and being used by the kernel.)
int
argstr(int n, char **pp)
{
80105286:	55                   	push   %ebp
80105287:	89 e5                	mov    %esp,%ebp
80105289:	83 ec 18             	sub    $0x18,%esp
  int addr;
  if(argint(n, &addr) < 0)
8010528c:	8d 45 fc             	lea    -0x4(%ebp),%eax
8010528f:	89 44 24 04          	mov    %eax,0x4(%esp)
80105293:	8b 45 08             	mov    0x8(%ebp),%eax
80105296:	89 04 24             	mov    %eax,(%esp)
80105299:	e8 58 ff ff ff       	call   801051f6 <argint>
8010529e:	85 c0                	test   %eax,%eax
801052a0:	79 07                	jns    801052a9 <argstr+0x23>
    return -1;
801052a2:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801052a7:	eb 12                	jmp    801052bb <argstr+0x35>
  return fetchstr(addr, pp);
801052a9:	8b 45 fc             	mov    -0x4(%ebp),%eax
801052ac:	8b 55 0c             	mov    0xc(%ebp),%edx
801052af:	89 54 24 04          	mov    %edx,0x4(%esp)
801052b3:	89 04 24             	mov    %eax,(%esp)
801052b6:	e8 d7 fe ff ff       	call   80105192 <fetchstr>
}
801052bb:	c9                   	leave  
801052bc:	c3                   	ret    

801052bd <syscall>:
[SYS_close]   sys_close,
};

void
syscall(void)
{
801052bd:	55                   	push   %ebp
801052be:	89 e5                	mov    %esp,%ebp
801052c0:	53                   	push   %ebx
801052c1:	83 ec 24             	sub    $0x24,%esp
  int num;

  num = proc->tf->eax;
801052c4:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801052ca:	8b 40 18             	mov    0x18(%eax),%eax
801052cd:	8b 40 1c             	mov    0x1c(%eax),%eax
801052d0:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
801052d3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801052d7:	7e 30                	jle    80105309 <syscall+0x4c>
801052d9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801052dc:	83 f8 15             	cmp    $0x15,%eax
801052df:	77 28                	ja     80105309 <syscall+0x4c>
801052e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801052e4:	8b 04 85 40 c0 10 80 	mov    -0x7fef3fc0(,%eax,4),%eax
801052eb:	85 c0                	test   %eax,%eax
801052ed:	74 1a                	je     80105309 <syscall+0x4c>
    proc->tf->eax = syscalls[num]();
801052ef:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801052f5:	8b 58 18             	mov    0x18(%eax),%ebx
801052f8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801052fb:	8b 04 85 40 c0 10 80 	mov    -0x7fef3fc0(,%eax,4),%eax
80105302:	ff d0                	call   *%eax
80105304:	89 43 1c             	mov    %eax,0x1c(%ebx)
80105307:	eb 3d                	jmp    80105346 <syscall+0x89>
  } else {
    cprintf("%d %s: unknown sys call %d\n",
            proc->pid, proc->name, num);
80105309:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010530f:	8d 48 6c             	lea    0x6c(%eax),%ecx
80105312:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax

  num = proc->tf->eax;
  if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
    proc->tf->eax = syscalls[num]();
  } else {
    cprintf("%d %s: unknown sys call %d\n",
80105318:	8b 40 10             	mov    0x10(%eax),%eax
8010531b:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010531e:	89 54 24 0c          	mov    %edx,0xc(%esp)
80105322:	89 4c 24 08          	mov    %ecx,0x8(%esp)
80105326:	89 44 24 04          	mov    %eax,0x4(%esp)
8010532a:	c7 04 24 3e 8d 10 80 	movl   $0x80108d3e,(%esp)
80105331:	e8 6b b0 ff ff       	call   801003a1 <cprintf>
            proc->pid, proc->name, num);
    proc->tf->eax = -1;
80105336:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010533c:	8b 40 18             	mov    0x18(%eax),%eax
8010533f:	c7 40 1c ff ff ff ff 	movl   $0xffffffff,0x1c(%eax)
  }
}
80105346:	83 c4 24             	add    $0x24,%esp
80105349:	5b                   	pop    %ebx
8010534a:	5d                   	pop    %ebp
8010534b:	c3                   	ret    

8010534c <argfd>:

// Fetch the nth word-sized system call argument as a file descriptor
// and return both the descriptor and the corresponding struct file.
static int
argfd(int n, int *pfd, struct file **pf)
{
8010534c:	55                   	push   %ebp
8010534d:	89 e5                	mov    %esp,%ebp
8010534f:	83 ec 28             	sub    $0x28,%esp
  int fd;
  struct file *f;

  if(argint(n, &fd) < 0)
80105352:	8d 45 f0             	lea    -0x10(%ebp),%eax
80105355:	89 44 24 04          	mov    %eax,0x4(%esp)
80105359:	8b 45 08             	mov    0x8(%ebp),%eax
8010535c:	89 04 24             	mov    %eax,(%esp)
8010535f:	e8 92 fe ff ff       	call   801051f6 <argint>
80105364:	85 c0                	test   %eax,%eax
80105366:	79 07                	jns    8010536f <argfd+0x23>
    return -1;
80105368:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010536d:	eb 50                	jmp    801053bf <argfd+0x73>
  if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0)
8010536f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105372:	85 c0                	test   %eax,%eax
80105374:	78 21                	js     80105397 <argfd+0x4b>
80105376:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105379:	83 f8 0f             	cmp    $0xf,%eax
8010537c:	7f 19                	jg     80105397 <argfd+0x4b>
8010537e:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105384:	8b 55 f0             	mov    -0x10(%ebp),%edx
80105387:	83 c2 08             	add    $0x8,%edx
8010538a:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
8010538e:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105391:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105395:	75 07                	jne    8010539e <argfd+0x52>
    return -1;
80105397:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010539c:	eb 21                	jmp    801053bf <argfd+0x73>
  if(pfd)
8010539e:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
801053a2:	74 08                	je     801053ac <argfd+0x60>
    *pfd = fd;
801053a4:	8b 55 f0             	mov    -0x10(%ebp),%edx
801053a7:	8b 45 0c             	mov    0xc(%ebp),%eax
801053aa:	89 10                	mov    %edx,(%eax)
  if(pf)
801053ac:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801053b0:	74 08                	je     801053ba <argfd+0x6e>
    *pf = f;
801053b2:	8b 45 10             	mov    0x10(%ebp),%eax
801053b5:	8b 55 f4             	mov    -0xc(%ebp),%edx
801053b8:	89 10                	mov    %edx,(%eax)
  return 0;
801053ba:	b8 00 00 00 00       	mov    $0x0,%eax
}
801053bf:	c9                   	leave  
801053c0:	c3                   	ret    

801053c1 <fdalloc>:

// Allocate a file descriptor for the given file.
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
801053c1:	55                   	push   %ebp
801053c2:	89 e5                	mov    %esp,%ebp
801053c4:	83 ec 10             	sub    $0x10,%esp
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
801053c7:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
801053ce:	eb 30                	jmp    80105400 <fdalloc+0x3f>
    if(proc->ofile[fd] == 0){
801053d0:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801053d6:	8b 55 fc             	mov    -0x4(%ebp),%edx
801053d9:	83 c2 08             	add    $0x8,%edx
801053dc:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
801053e0:	85 c0                	test   %eax,%eax
801053e2:	75 18                	jne    801053fc <fdalloc+0x3b>
      proc->ofile[fd] = f;
801053e4:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801053ea:	8b 55 fc             	mov    -0x4(%ebp),%edx
801053ed:	8d 4a 08             	lea    0x8(%edx),%ecx
801053f0:	8b 55 08             	mov    0x8(%ebp),%edx
801053f3:	89 54 88 08          	mov    %edx,0x8(%eax,%ecx,4)
      return fd;
801053f7:	8b 45 fc             	mov    -0x4(%ebp),%eax
801053fa:	eb 0f                	jmp    8010540b <fdalloc+0x4a>
static int
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
801053fc:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80105400:	83 7d fc 0f          	cmpl   $0xf,-0x4(%ebp)
80105404:	7e ca                	jle    801053d0 <fdalloc+0xf>
    if(proc->ofile[fd] == 0){
      proc->ofile[fd] = f;
      return fd;
    }
  }
  return -1;
80105406:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
8010540b:	c9                   	leave  
8010540c:	c3                   	ret    

8010540d <sys_dup>:

int
sys_dup(void)
{
8010540d:	55                   	push   %ebp
8010540e:	89 e5                	mov    %esp,%ebp
80105410:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  int fd;

  if(argfd(0, 0, &f) < 0)
80105413:	8d 45 f0             	lea    -0x10(%ebp),%eax
80105416:	89 44 24 08          	mov    %eax,0x8(%esp)
8010541a:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80105421:	00 
80105422:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105429:	e8 1e ff ff ff       	call   8010534c <argfd>
8010542e:	85 c0                	test   %eax,%eax
80105430:	79 07                	jns    80105439 <sys_dup+0x2c>
    return -1;
80105432:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105437:	eb 29                	jmp    80105462 <sys_dup+0x55>
  if((fd=fdalloc(f)) < 0)
80105439:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010543c:	89 04 24             	mov    %eax,(%esp)
8010543f:	e8 7d ff ff ff       	call   801053c1 <fdalloc>
80105444:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105447:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010544b:	79 07                	jns    80105454 <sys_dup+0x47>
    return -1;
8010544d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105452:	eb 0e                	jmp    80105462 <sys_dup+0x55>
  filedup(f);
80105454:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105457:	89 04 24             	mov    %eax,(%esp)
8010545a:	e8 2d bb ff ff       	call   80100f8c <filedup>
  return fd;
8010545f:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80105462:	c9                   	leave  
80105463:	c3                   	ret    

80105464 <sys_read>:

int
sys_read(void)
{
80105464:	55                   	push   %ebp
80105465:	89 e5                	mov    %esp,%ebp
80105467:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
8010546a:	8d 45 f4             	lea    -0xc(%ebp),%eax
8010546d:	89 44 24 08          	mov    %eax,0x8(%esp)
80105471:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80105478:	00 
80105479:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105480:	e8 c7 fe ff ff       	call   8010534c <argfd>
80105485:	85 c0                	test   %eax,%eax
80105487:	78 35                	js     801054be <sys_read+0x5a>
80105489:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010548c:	89 44 24 04          	mov    %eax,0x4(%esp)
80105490:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
80105497:	e8 5a fd ff ff       	call   801051f6 <argint>
8010549c:	85 c0                	test   %eax,%eax
8010549e:	78 1e                	js     801054be <sys_read+0x5a>
801054a0:	8b 45 f0             	mov    -0x10(%ebp),%eax
801054a3:	89 44 24 08          	mov    %eax,0x8(%esp)
801054a7:	8d 45 ec             	lea    -0x14(%ebp),%eax
801054aa:	89 44 24 04          	mov    %eax,0x4(%esp)
801054ae:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
801054b5:	e8 6a fd ff ff       	call   80105224 <argptr>
801054ba:	85 c0                	test   %eax,%eax
801054bc:	79 07                	jns    801054c5 <sys_read+0x61>
    return -1;
801054be:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801054c3:	eb 19                	jmp    801054de <sys_read+0x7a>
  return fileread(f, p, n);
801054c5:	8b 4d f0             	mov    -0x10(%ebp),%ecx
801054c8:	8b 55 ec             	mov    -0x14(%ebp),%edx
801054cb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801054ce:	89 4c 24 08          	mov    %ecx,0x8(%esp)
801054d2:	89 54 24 04          	mov    %edx,0x4(%esp)
801054d6:	89 04 24             	mov    %eax,(%esp)
801054d9:	e8 1b bc ff ff       	call   801010f9 <fileread>
}
801054de:	c9                   	leave  
801054df:	c3                   	ret    

801054e0 <sys_write>:

int
sys_write(void)
{
801054e0:	55                   	push   %ebp
801054e1:	89 e5                	mov    %esp,%ebp
801054e3:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
801054e6:	8d 45 f4             	lea    -0xc(%ebp),%eax
801054e9:	89 44 24 08          	mov    %eax,0x8(%esp)
801054ed:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801054f4:	00 
801054f5:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
801054fc:	e8 4b fe ff ff       	call   8010534c <argfd>
80105501:	85 c0                	test   %eax,%eax
80105503:	78 35                	js     8010553a <sys_write+0x5a>
80105505:	8d 45 f0             	lea    -0x10(%ebp),%eax
80105508:	89 44 24 04          	mov    %eax,0x4(%esp)
8010550c:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
80105513:	e8 de fc ff ff       	call   801051f6 <argint>
80105518:	85 c0                	test   %eax,%eax
8010551a:	78 1e                	js     8010553a <sys_write+0x5a>
8010551c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010551f:	89 44 24 08          	mov    %eax,0x8(%esp)
80105523:	8d 45 ec             	lea    -0x14(%ebp),%eax
80105526:	89 44 24 04          	mov    %eax,0x4(%esp)
8010552a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80105531:	e8 ee fc ff ff       	call   80105224 <argptr>
80105536:	85 c0                	test   %eax,%eax
80105538:	79 07                	jns    80105541 <sys_write+0x61>
    return -1;
8010553a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010553f:	eb 19                	jmp    8010555a <sys_write+0x7a>
  return filewrite(f, p, n);
80105541:	8b 4d f0             	mov    -0x10(%ebp),%ecx
80105544:	8b 55 ec             	mov    -0x14(%ebp),%edx
80105547:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010554a:	89 4c 24 08          	mov    %ecx,0x8(%esp)
8010554e:	89 54 24 04          	mov    %edx,0x4(%esp)
80105552:	89 04 24             	mov    %eax,(%esp)
80105555:	e8 5b bc ff ff       	call   801011b5 <filewrite>
}
8010555a:	c9                   	leave  
8010555b:	c3                   	ret    

8010555c <sys_close>:

int
sys_close(void)
{
8010555c:	55                   	push   %ebp
8010555d:	89 e5                	mov    %esp,%ebp
8010555f:	83 ec 28             	sub    $0x28,%esp
  int fd;
  struct file *f;

  if(argfd(0, &fd, &f) < 0)
80105562:	8d 45 f0             	lea    -0x10(%ebp),%eax
80105565:	89 44 24 08          	mov    %eax,0x8(%esp)
80105569:	8d 45 f4             	lea    -0xc(%ebp),%eax
8010556c:	89 44 24 04          	mov    %eax,0x4(%esp)
80105570:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105577:	e8 d0 fd ff ff       	call   8010534c <argfd>
8010557c:	85 c0                	test   %eax,%eax
8010557e:	79 07                	jns    80105587 <sys_close+0x2b>
    return -1;
80105580:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105585:	eb 24                	jmp    801055ab <sys_close+0x4f>
  proc->ofile[fd] = 0;
80105587:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010558d:	8b 55 f4             	mov    -0xc(%ebp),%edx
80105590:	83 c2 08             	add    $0x8,%edx
80105593:	c7 44 90 08 00 00 00 	movl   $0x0,0x8(%eax,%edx,4)
8010559a:	00 
  fileclose(f);
8010559b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010559e:	89 04 24             	mov    %eax,(%esp)
801055a1:	e8 2e ba ff ff       	call   80100fd4 <fileclose>
  return 0;
801055a6:	b8 00 00 00 00       	mov    $0x0,%eax
}
801055ab:	c9                   	leave  
801055ac:	c3                   	ret    

801055ad <sys_fstat>:

int
sys_fstat(void)
{
801055ad:	55                   	push   %ebp
801055ae:	89 e5                	mov    %esp,%ebp
801055b0:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  struct stat *st;

  if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
801055b3:	8d 45 f4             	lea    -0xc(%ebp),%eax
801055b6:	89 44 24 08          	mov    %eax,0x8(%esp)
801055ba:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801055c1:	00 
801055c2:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
801055c9:	e8 7e fd ff ff       	call   8010534c <argfd>
801055ce:	85 c0                	test   %eax,%eax
801055d0:	78 1f                	js     801055f1 <sys_fstat+0x44>
801055d2:	c7 44 24 08 14 00 00 	movl   $0x14,0x8(%esp)
801055d9:	00 
801055da:	8d 45 f0             	lea    -0x10(%ebp),%eax
801055dd:	89 44 24 04          	mov    %eax,0x4(%esp)
801055e1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
801055e8:	e8 37 fc ff ff       	call   80105224 <argptr>
801055ed:	85 c0                	test   %eax,%eax
801055ef:	79 07                	jns    801055f8 <sys_fstat+0x4b>
    return -1;
801055f1:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801055f6:	eb 12                	jmp    8010560a <sys_fstat+0x5d>
  return filestat(f, st);
801055f8:	8b 55 f0             	mov    -0x10(%ebp),%edx
801055fb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801055fe:	89 54 24 04          	mov    %edx,0x4(%esp)
80105602:	89 04 24             	mov    %eax,(%esp)
80105605:	e8 a0 ba ff ff       	call   801010aa <filestat>
}
8010560a:	c9                   	leave  
8010560b:	c3                   	ret    

8010560c <sys_link>:

// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
8010560c:	55                   	push   %ebp
8010560d:	89 e5                	mov    %esp,%ebp
8010560f:	83 ec 38             	sub    $0x38,%esp
  char name[DIRSIZ], *new, *old;
  struct inode *dp, *ip;

  if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
80105612:	8d 45 d8             	lea    -0x28(%ebp),%eax
80105615:	89 44 24 04          	mov    %eax,0x4(%esp)
80105619:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105620:	e8 61 fc ff ff       	call   80105286 <argstr>
80105625:	85 c0                	test   %eax,%eax
80105627:	78 17                	js     80105640 <sys_link+0x34>
80105629:	8d 45 dc             	lea    -0x24(%ebp),%eax
8010562c:	89 44 24 04          	mov    %eax,0x4(%esp)
80105630:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80105637:	e8 4a fc ff ff       	call   80105286 <argstr>
8010563c:	85 c0                	test   %eax,%eax
8010563e:	79 0a                	jns    8010564a <sys_link+0x3e>
    return -1;
80105640:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105645:	e9 3c 01 00 00       	jmp    80105786 <sys_link+0x17a>
  if((ip = namei(old)) == 0)
8010564a:	8b 45 d8             	mov    -0x28(%ebp),%eax
8010564d:	89 04 24             	mov    %eax,(%esp)
80105650:	e8 c5 cd ff ff       	call   8010241a <namei>
80105655:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105658:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010565c:	75 0a                	jne    80105668 <sys_link+0x5c>
    return -1;
8010565e:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105663:	e9 1e 01 00 00       	jmp    80105786 <sys_link+0x17a>

  begin_trans();
80105668:	e8 c4 dc ff ff       	call   80103331 <begin_trans>

  ilock(ip);
8010566d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105670:	89 04 24             	mov    %eax,(%esp)
80105673:	e8 00 c2 ff ff       	call   80101878 <ilock>
  if(ip->type == T_DIR){
80105678:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010567b:	0f b7 40 10          	movzwl 0x10(%eax),%eax
8010567f:	66 83 f8 01          	cmp    $0x1,%ax
80105683:	75 1a                	jne    8010569f <sys_link+0x93>
    iunlockput(ip);
80105685:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105688:	89 04 24             	mov    %eax,(%esp)
8010568b:	e8 6c c4 ff ff       	call   80101afc <iunlockput>
    commit_trans();
80105690:	e8 e5 dc ff ff       	call   8010337a <commit_trans>
    return -1;
80105695:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010569a:	e9 e7 00 00 00       	jmp    80105786 <sys_link+0x17a>
  }

  ip->nlink++;
8010569f:	8b 45 f4             	mov    -0xc(%ebp),%eax
801056a2:	0f b7 40 16          	movzwl 0x16(%eax),%eax
801056a6:	8d 50 01             	lea    0x1(%eax),%edx
801056a9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801056ac:	66 89 50 16          	mov    %dx,0x16(%eax)
  iupdate(ip);
801056b0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801056b3:	89 04 24             	mov    %eax,(%esp)
801056b6:	e8 01 c0 ff ff       	call   801016bc <iupdate>
  iunlock(ip);
801056bb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801056be:	89 04 24             	mov    %eax,(%esp)
801056c1:	e8 00 c3 ff ff       	call   801019c6 <iunlock>

  if((dp = nameiparent(new, name)) == 0)
801056c6:	8b 45 dc             	mov    -0x24(%ebp),%eax
801056c9:	8d 55 e2             	lea    -0x1e(%ebp),%edx
801056cc:	89 54 24 04          	mov    %edx,0x4(%esp)
801056d0:	89 04 24             	mov    %eax,(%esp)
801056d3:	e8 64 cd ff ff       	call   8010243c <nameiparent>
801056d8:	89 45 f0             	mov    %eax,-0x10(%ebp)
801056db:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801056df:	74 68                	je     80105749 <sys_link+0x13d>
    goto bad;
  ilock(dp);
801056e1:	8b 45 f0             	mov    -0x10(%ebp),%eax
801056e4:	89 04 24             	mov    %eax,(%esp)
801056e7:	e8 8c c1 ff ff       	call   80101878 <ilock>
  if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
801056ec:	8b 45 f0             	mov    -0x10(%ebp),%eax
801056ef:	8b 10                	mov    (%eax),%edx
801056f1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801056f4:	8b 00                	mov    (%eax),%eax
801056f6:	39 c2                	cmp    %eax,%edx
801056f8:	75 20                	jne    8010571a <sys_link+0x10e>
801056fa:	8b 45 f4             	mov    -0xc(%ebp),%eax
801056fd:	8b 40 04             	mov    0x4(%eax),%eax
80105700:	89 44 24 08          	mov    %eax,0x8(%esp)
80105704:	8d 45 e2             	lea    -0x1e(%ebp),%eax
80105707:	89 44 24 04          	mov    %eax,0x4(%esp)
8010570b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010570e:	89 04 24             	mov    %eax,(%esp)
80105711:	e8 43 ca ff ff       	call   80102159 <dirlink>
80105716:	85 c0                	test   %eax,%eax
80105718:	79 0d                	jns    80105727 <sys_link+0x11b>
    iunlockput(dp);
8010571a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010571d:	89 04 24             	mov    %eax,(%esp)
80105720:	e8 d7 c3 ff ff       	call   80101afc <iunlockput>
    goto bad;
80105725:	eb 23                	jmp    8010574a <sys_link+0x13e>
  }
  iunlockput(dp);
80105727:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010572a:	89 04 24             	mov    %eax,(%esp)
8010572d:	e8 ca c3 ff ff       	call   80101afc <iunlockput>
  iput(ip);
80105732:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105735:	89 04 24             	mov    %eax,(%esp)
80105738:	e8 ee c2 ff ff       	call   80101a2b <iput>

  commit_trans();
8010573d:	e8 38 dc ff ff       	call   8010337a <commit_trans>

  return 0;
80105742:	b8 00 00 00 00       	mov    $0x0,%eax
80105747:	eb 3d                	jmp    80105786 <sys_link+0x17a>
  ip->nlink++;
  iupdate(ip);
  iunlock(ip);

  if((dp = nameiparent(new, name)) == 0)
    goto bad;
80105749:	90                   	nop
  commit_trans();

  return 0;

bad:
  ilock(ip);
8010574a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010574d:	89 04 24             	mov    %eax,(%esp)
80105750:	e8 23 c1 ff ff       	call   80101878 <ilock>
  ip->nlink--;
80105755:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105758:	0f b7 40 16          	movzwl 0x16(%eax),%eax
8010575c:	8d 50 ff             	lea    -0x1(%eax),%edx
8010575f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105762:	66 89 50 16          	mov    %dx,0x16(%eax)
  iupdate(ip);
80105766:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105769:	89 04 24             	mov    %eax,(%esp)
8010576c:	e8 4b bf ff ff       	call   801016bc <iupdate>
  iunlockput(ip);
80105771:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105774:	89 04 24             	mov    %eax,(%esp)
80105777:	e8 80 c3 ff ff       	call   80101afc <iunlockput>
  commit_trans();
8010577c:	e8 f9 db ff ff       	call   8010337a <commit_trans>
  return -1;
80105781:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80105786:	c9                   	leave  
80105787:	c3                   	ret    

80105788 <isdirempty>:

// Is the directory dp empty except for "." and ".." ?
static int
isdirempty(struct inode *dp)
{
80105788:	55                   	push   %ebp
80105789:	89 e5                	mov    %esp,%ebp
8010578b:	83 ec 38             	sub    $0x38,%esp
  int off;
  struct dirent de;

  for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
8010578e:	c7 45 f4 20 00 00 00 	movl   $0x20,-0xc(%ebp)
80105795:	eb 4b                	jmp    801057e2 <isdirempty+0x5a>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80105797:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010579a:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
801057a1:	00 
801057a2:	89 44 24 08          	mov    %eax,0x8(%esp)
801057a6:	8d 45 e4             	lea    -0x1c(%ebp),%eax
801057a9:	89 44 24 04          	mov    %eax,0x4(%esp)
801057ad:	8b 45 08             	mov    0x8(%ebp),%eax
801057b0:	89 04 24             	mov    %eax,(%esp)
801057b3:	e8 b6 c5 ff ff       	call   80101d6e <readi>
801057b8:	83 f8 10             	cmp    $0x10,%eax
801057bb:	74 0c                	je     801057c9 <isdirempty+0x41>
      panic("isdirempty: readi");
801057bd:	c7 04 24 5a 8d 10 80 	movl   $0x80108d5a,(%esp)
801057c4:	e8 8c ad ff ff       	call   80100555 <panic>
    if(de.inum != 0)
801057c9:	0f b7 45 e4          	movzwl -0x1c(%ebp),%eax
801057cd:	66 85 c0             	test   %ax,%ax
801057d0:	74 07                	je     801057d9 <isdirempty+0x51>
      return 0;
801057d2:	b8 00 00 00 00       	mov    $0x0,%eax
801057d7:	eb 1b                	jmp    801057f4 <isdirempty+0x6c>
isdirempty(struct inode *dp)
{
  int off;
  struct dirent de;

  for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
801057d9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801057dc:	83 c0 10             	add    $0x10,%eax
801057df:	89 45 f4             	mov    %eax,-0xc(%ebp)
801057e2:	8b 55 f4             	mov    -0xc(%ebp),%edx
801057e5:	8b 45 08             	mov    0x8(%ebp),%eax
801057e8:	8b 40 18             	mov    0x18(%eax),%eax
801057eb:	39 c2                	cmp    %eax,%edx
801057ed:	72 a8                	jb     80105797 <isdirempty+0xf>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
      panic("isdirempty: readi");
    if(de.inum != 0)
      return 0;
  }
  return 1;
801057ef:	b8 01 00 00 00       	mov    $0x1,%eax
}
801057f4:	c9                   	leave  
801057f5:	c3                   	ret    

801057f6 <sys_unlink>:

//PAGEBREAK!
int
sys_unlink(void)
{
801057f6:	55                   	push   %ebp
801057f7:	89 e5                	mov    %esp,%ebp
801057f9:	83 ec 48             	sub    $0x48,%esp
  struct inode *ip, *dp;
  struct dirent de;
  char name[DIRSIZ], *path;
  uint off;

  if(argstr(0, &path) < 0)
801057fc:	8d 45 cc             	lea    -0x34(%ebp),%eax
801057ff:	89 44 24 04          	mov    %eax,0x4(%esp)
80105803:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
8010580a:	e8 77 fa ff ff       	call   80105286 <argstr>
8010580f:	85 c0                	test   %eax,%eax
80105811:	79 0a                	jns    8010581d <sys_unlink+0x27>
    return -1;
80105813:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105818:	e9 aa 01 00 00       	jmp    801059c7 <sys_unlink+0x1d1>
  if((dp = nameiparent(path, name)) == 0)
8010581d:	8b 45 cc             	mov    -0x34(%ebp),%eax
80105820:	8d 55 d2             	lea    -0x2e(%ebp),%edx
80105823:	89 54 24 04          	mov    %edx,0x4(%esp)
80105827:	89 04 24             	mov    %eax,(%esp)
8010582a:	e8 0d cc ff ff       	call   8010243c <nameiparent>
8010582f:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105832:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105836:	75 0a                	jne    80105842 <sys_unlink+0x4c>
    return -1;
80105838:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010583d:	e9 85 01 00 00       	jmp    801059c7 <sys_unlink+0x1d1>

  begin_trans();
80105842:	e8 ea da ff ff       	call   80103331 <begin_trans>

  ilock(dp);
80105847:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010584a:	89 04 24             	mov    %eax,(%esp)
8010584d:	e8 26 c0 ff ff       	call   80101878 <ilock>

  // Cannot unlink "." or "..".
  if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
80105852:	c7 44 24 04 6c 8d 10 	movl   $0x80108d6c,0x4(%esp)
80105859:	80 
8010585a:	8d 45 d2             	lea    -0x2e(%ebp),%eax
8010585d:	89 04 24             	mov    %eax,(%esp)
80105860:	e8 0a c8 ff ff       	call   8010206f <namecmp>
80105865:	85 c0                	test   %eax,%eax
80105867:	0f 84 45 01 00 00    	je     801059b2 <sys_unlink+0x1bc>
8010586d:	c7 44 24 04 6e 8d 10 	movl   $0x80108d6e,0x4(%esp)
80105874:	80 
80105875:	8d 45 d2             	lea    -0x2e(%ebp),%eax
80105878:	89 04 24             	mov    %eax,(%esp)
8010587b:	e8 ef c7 ff ff       	call   8010206f <namecmp>
80105880:	85 c0                	test   %eax,%eax
80105882:	0f 84 2a 01 00 00    	je     801059b2 <sys_unlink+0x1bc>
    goto bad;

  if((ip = dirlookup(dp, name, &off)) == 0)
80105888:	8d 45 c8             	lea    -0x38(%ebp),%eax
8010588b:	89 44 24 08          	mov    %eax,0x8(%esp)
8010588f:	8d 45 d2             	lea    -0x2e(%ebp),%eax
80105892:	89 44 24 04          	mov    %eax,0x4(%esp)
80105896:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105899:	89 04 24             	mov    %eax,(%esp)
8010589c:	e8 f0 c7 ff ff       	call   80102091 <dirlookup>
801058a1:	89 45 f0             	mov    %eax,-0x10(%ebp)
801058a4:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801058a8:	0f 84 03 01 00 00    	je     801059b1 <sys_unlink+0x1bb>
    goto bad;
  ilock(ip);
801058ae:	8b 45 f0             	mov    -0x10(%ebp),%eax
801058b1:	89 04 24             	mov    %eax,(%esp)
801058b4:	e8 bf bf ff ff       	call   80101878 <ilock>

  if(ip->nlink < 1)
801058b9:	8b 45 f0             	mov    -0x10(%ebp),%eax
801058bc:	0f b7 40 16          	movzwl 0x16(%eax),%eax
801058c0:	66 85 c0             	test   %ax,%ax
801058c3:	7f 0c                	jg     801058d1 <sys_unlink+0xdb>
    panic("unlink: nlink < 1");
801058c5:	c7 04 24 71 8d 10 80 	movl   $0x80108d71,(%esp)
801058cc:	e8 84 ac ff ff       	call   80100555 <panic>
  if(ip->type == T_DIR && !isdirempty(ip)){
801058d1:	8b 45 f0             	mov    -0x10(%ebp),%eax
801058d4:	0f b7 40 10          	movzwl 0x10(%eax),%eax
801058d8:	66 83 f8 01          	cmp    $0x1,%ax
801058dc:	75 1f                	jne    801058fd <sys_unlink+0x107>
801058de:	8b 45 f0             	mov    -0x10(%ebp),%eax
801058e1:	89 04 24             	mov    %eax,(%esp)
801058e4:	e8 9f fe ff ff       	call   80105788 <isdirempty>
801058e9:	85 c0                	test   %eax,%eax
801058eb:	75 10                	jne    801058fd <sys_unlink+0x107>
    iunlockput(ip);
801058ed:	8b 45 f0             	mov    -0x10(%ebp),%eax
801058f0:	89 04 24             	mov    %eax,(%esp)
801058f3:	e8 04 c2 ff ff       	call   80101afc <iunlockput>
    goto bad;
801058f8:	e9 b5 00 00 00       	jmp    801059b2 <sys_unlink+0x1bc>
  }

  memset(&de, 0, sizeof(de));
801058fd:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
80105904:	00 
80105905:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
8010590c:	00 
8010590d:	8d 45 e0             	lea    -0x20(%ebp),%eax
80105910:	89 04 24             	mov    %eax,(%esp)
80105913:	e8 82 f5 ff ff       	call   80104e9a <memset>
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80105918:	8b 45 c8             	mov    -0x38(%ebp),%eax
8010591b:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
80105922:	00 
80105923:	89 44 24 08          	mov    %eax,0x8(%esp)
80105927:	8d 45 e0             	lea    -0x20(%ebp),%eax
8010592a:	89 44 24 04          	mov    %eax,0x4(%esp)
8010592e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105931:	89 04 24             	mov    %eax,(%esp)
80105934:	e8 a0 c5 ff ff       	call   80101ed9 <writei>
80105939:	83 f8 10             	cmp    $0x10,%eax
8010593c:	74 0c                	je     8010594a <sys_unlink+0x154>
    panic("unlink: writei");
8010593e:	c7 04 24 83 8d 10 80 	movl   $0x80108d83,(%esp)
80105945:	e8 0b ac ff ff       	call   80100555 <panic>
  if(ip->type == T_DIR){
8010594a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010594d:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80105951:	66 83 f8 01          	cmp    $0x1,%ax
80105955:	75 1c                	jne    80105973 <sys_unlink+0x17d>
    dp->nlink--;
80105957:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010595a:	0f b7 40 16          	movzwl 0x16(%eax),%eax
8010595e:	8d 50 ff             	lea    -0x1(%eax),%edx
80105961:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105964:	66 89 50 16          	mov    %dx,0x16(%eax)
    iupdate(dp);
80105968:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010596b:	89 04 24             	mov    %eax,(%esp)
8010596e:	e8 49 bd ff ff       	call   801016bc <iupdate>
  }
  iunlockput(dp);
80105973:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105976:	89 04 24             	mov    %eax,(%esp)
80105979:	e8 7e c1 ff ff       	call   80101afc <iunlockput>

  ip->nlink--;
8010597e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105981:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80105985:	8d 50 ff             	lea    -0x1(%eax),%edx
80105988:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010598b:	66 89 50 16          	mov    %dx,0x16(%eax)
  iupdate(ip);
8010598f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105992:	89 04 24             	mov    %eax,(%esp)
80105995:	e8 22 bd ff ff       	call   801016bc <iupdate>
  iunlockput(ip);
8010599a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010599d:	89 04 24             	mov    %eax,(%esp)
801059a0:	e8 57 c1 ff ff       	call   80101afc <iunlockput>

  commit_trans();
801059a5:	e8 d0 d9 ff ff       	call   8010337a <commit_trans>

  return 0;
801059aa:	b8 00 00 00 00       	mov    $0x0,%eax
801059af:	eb 16                	jmp    801059c7 <sys_unlink+0x1d1>
  // Cannot unlink "." or "..".
  if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
    goto bad;

  if((ip = dirlookup(dp, name, &off)) == 0)
    goto bad;
801059b1:	90                   	nop
  commit_trans();

  return 0;

bad:
  iunlockput(dp);
801059b2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801059b5:	89 04 24             	mov    %eax,(%esp)
801059b8:	e8 3f c1 ff ff       	call   80101afc <iunlockput>
  commit_trans();
801059bd:	e8 b8 d9 ff ff       	call   8010337a <commit_trans>
  return -1;
801059c2:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
801059c7:	c9                   	leave  
801059c8:	c3                   	ret    

801059c9 <create>:

struct inode*
create(char *path, short type, short major, short minor)
{
801059c9:	55                   	push   %ebp
801059ca:	89 e5                	mov    %esp,%ebp
801059cc:	83 ec 48             	sub    $0x48,%esp
801059cf:	8b 4d 0c             	mov    0xc(%ebp),%ecx
801059d2:	8b 55 10             	mov    0x10(%ebp),%edx
801059d5:	8b 45 14             	mov    0x14(%ebp),%eax
801059d8:	66 89 4d d4          	mov    %cx,-0x2c(%ebp)
801059dc:	66 89 55 d0          	mov    %dx,-0x30(%ebp)
801059e0:	66 89 45 cc          	mov    %ax,-0x34(%ebp)
  uint off;
  struct inode *ip, *dp;
  char name[DIRSIZ];

  if((dp = nameiparent(path, name)) == 0)
801059e4:	8d 45 de             	lea    -0x22(%ebp),%eax
801059e7:	89 44 24 04          	mov    %eax,0x4(%esp)
801059eb:	8b 45 08             	mov    0x8(%ebp),%eax
801059ee:	89 04 24             	mov    %eax,(%esp)
801059f1:	e8 46 ca ff ff       	call   8010243c <nameiparent>
801059f6:	89 45 f4             	mov    %eax,-0xc(%ebp)
801059f9:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801059fd:	75 0a                	jne    80105a09 <create+0x40>
    return 0;
801059ff:	b8 00 00 00 00       	mov    $0x0,%eax
80105a04:	e9 7e 01 00 00       	jmp    80105b87 <create+0x1be>
  ilock(dp);
80105a09:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105a0c:	89 04 24             	mov    %eax,(%esp)
80105a0f:	e8 64 be ff ff       	call   80101878 <ilock>

  if((ip = dirlookup(dp, name, &off)) != 0){
80105a14:	8d 45 ec             	lea    -0x14(%ebp),%eax
80105a17:	89 44 24 08          	mov    %eax,0x8(%esp)
80105a1b:	8d 45 de             	lea    -0x22(%ebp),%eax
80105a1e:	89 44 24 04          	mov    %eax,0x4(%esp)
80105a22:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105a25:	89 04 24             	mov    %eax,(%esp)
80105a28:	e8 64 c6 ff ff       	call   80102091 <dirlookup>
80105a2d:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105a30:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105a34:	74 47                	je     80105a7d <create+0xb4>
    iunlockput(dp);
80105a36:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105a39:	89 04 24             	mov    %eax,(%esp)
80105a3c:	e8 bb c0 ff ff       	call   80101afc <iunlockput>
    ilock(ip);
80105a41:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105a44:	89 04 24             	mov    %eax,(%esp)
80105a47:	e8 2c be ff ff       	call   80101878 <ilock>
    if(type == T_FILE && ip->type == T_FILE)
80105a4c:	66 83 7d d4 02       	cmpw   $0x2,-0x2c(%ebp)
80105a51:	75 15                	jne    80105a68 <create+0x9f>
80105a53:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105a56:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80105a5a:	66 83 f8 02          	cmp    $0x2,%ax
80105a5e:	75 08                	jne    80105a68 <create+0x9f>
      return ip;
80105a60:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105a63:	e9 1f 01 00 00       	jmp    80105b87 <create+0x1be>
    iunlockput(ip);
80105a68:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105a6b:	89 04 24             	mov    %eax,(%esp)
80105a6e:	e8 89 c0 ff ff       	call   80101afc <iunlockput>
    return 0;
80105a73:	b8 00 00 00 00       	mov    $0x0,%eax
80105a78:	e9 0a 01 00 00       	jmp    80105b87 <create+0x1be>
  }

  if((ip = ialloc(dp->dev, type)) == 0)
80105a7d:	0f bf 55 d4          	movswl -0x2c(%ebp),%edx
80105a81:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105a84:	8b 00                	mov    (%eax),%eax
80105a86:	89 54 24 04          	mov    %edx,0x4(%esp)
80105a8a:	89 04 24             	mov    %eax,(%esp)
80105a8d:	e8 4d bb ff ff       	call   801015df <ialloc>
80105a92:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105a95:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105a99:	75 0c                	jne    80105aa7 <create+0xde>
    panic("create: ialloc");
80105a9b:	c7 04 24 92 8d 10 80 	movl   $0x80108d92,(%esp)
80105aa2:	e8 ae aa ff ff       	call   80100555 <panic>

  ilock(ip);
80105aa7:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105aaa:	89 04 24             	mov    %eax,(%esp)
80105aad:	e8 c6 bd ff ff       	call   80101878 <ilock>
  ip->major = major;
80105ab2:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105ab5:	0f b7 55 d0          	movzwl -0x30(%ebp),%edx
80105ab9:	66 89 50 12          	mov    %dx,0x12(%eax)
  ip->minor = minor;
80105abd:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105ac0:	0f b7 55 cc          	movzwl -0x34(%ebp),%edx
80105ac4:	66 89 50 14          	mov    %dx,0x14(%eax)
  ip->nlink = 1;
80105ac8:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105acb:	66 c7 40 16 01 00    	movw   $0x1,0x16(%eax)
  iupdate(ip);
80105ad1:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105ad4:	89 04 24             	mov    %eax,(%esp)
80105ad7:	e8 e0 bb ff ff       	call   801016bc <iupdate>

  if(type == T_DIR){  // Create . and .. entries.
80105adc:	66 83 7d d4 01       	cmpw   $0x1,-0x2c(%ebp)
80105ae1:	75 6a                	jne    80105b4d <create+0x184>
    dp->nlink++;  // for ".."
80105ae3:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105ae6:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80105aea:	8d 50 01             	lea    0x1(%eax),%edx
80105aed:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105af0:	66 89 50 16          	mov    %dx,0x16(%eax)
    iupdate(dp);
80105af4:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105af7:	89 04 24             	mov    %eax,(%esp)
80105afa:	e8 bd bb ff ff       	call   801016bc <iupdate>
    // No ip->nlink++ for ".": avoid cyclic ref count.
    if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
80105aff:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105b02:	8b 40 04             	mov    0x4(%eax),%eax
80105b05:	89 44 24 08          	mov    %eax,0x8(%esp)
80105b09:	c7 44 24 04 6c 8d 10 	movl   $0x80108d6c,0x4(%esp)
80105b10:	80 
80105b11:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105b14:	89 04 24             	mov    %eax,(%esp)
80105b17:	e8 3d c6 ff ff       	call   80102159 <dirlink>
80105b1c:	85 c0                	test   %eax,%eax
80105b1e:	78 21                	js     80105b41 <create+0x178>
80105b20:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b23:	8b 40 04             	mov    0x4(%eax),%eax
80105b26:	89 44 24 08          	mov    %eax,0x8(%esp)
80105b2a:	c7 44 24 04 6e 8d 10 	movl   $0x80108d6e,0x4(%esp)
80105b31:	80 
80105b32:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105b35:	89 04 24             	mov    %eax,(%esp)
80105b38:	e8 1c c6 ff ff       	call   80102159 <dirlink>
80105b3d:	85 c0                	test   %eax,%eax
80105b3f:	79 0c                	jns    80105b4d <create+0x184>
      panic("create dots");
80105b41:	c7 04 24 a1 8d 10 80 	movl   $0x80108da1,(%esp)
80105b48:	e8 08 aa ff ff       	call   80100555 <panic>
  }

  if(dirlink(dp, name, ip->inum) < 0)
80105b4d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105b50:	8b 40 04             	mov    0x4(%eax),%eax
80105b53:	89 44 24 08          	mov    %eax,0x8(%esp)
80105b57:	8d 45 de             	lea    -0x22(%ebp),%eax
80105b5a:	89 44 24 04          	mov    %eax,0x4(%esp)
80105b5e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b61:	89 04 24             	mov    %eax,(%esp)
80105b64:	e8 f0 c5 ff ff       	call   80102159 <dirlink>
80105b69:	85 c0                	test   %eax,%eax
80105b6b:	79 0c                	jns    80105b79 <create+0x1b0>
    panic("create: dirlink");
80105b6d:	c7 04 24 ad 8d 10 80 	movl   $0x80108dad,(%esp)
80105b74:	e8 dc a9 ff ff       	call   80100555 <panic>

  iunlockput(dp);
80105b79:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b7c:	89 04 24             	mov    %eax,(%esp)
80105b7f:	e8 78 bf ff ff       	call   80101afc <iunlockput>

  return ip;
80105b84:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
80105b87:	c9                   	leave  
80105b88:	c3                   	ret    

80105b89 <sys_open>:

int
sys_open(void)
{
80105b89:	55                   	push   %ebp
80105b8a:	89 e5                	mov    %esp,%ebp
80105b8c:	83 ec 38             	sub    $0x38,%esp
  char *path;
  int fd, omode;
  struct file *f;
  struct inode *ip;

  if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
80105b8f:	8d 45 e8             	lea    -0x18(%ebp),%eax
80105b92:	89 44 24 04          	mov    %eax,0x4(%esp)
80105b96:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105b9d:	e8 e4 f6 ff ff       	call   80105286 <argstr>
80105ba2:	85 c0                	test   %eax,%eax
80105ba4:	78 17                	js     80105bbd <sys_open+0x34>
80105ba6:	8d 45 e4             	lea    -0x1c(%ebp),%eax
80105ba9:	89 44 24 04          	mov    %eax,0x4(%esp)
80105bad:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80105bb4:	e8 3d f6 ff ff       	call   801051f6 <argint>
80105bb9:	85 c0                	test   %eax,%eax
80105bbb:	79 0a                	jns    80105bc7 <sys_open+0x3e>
    return -1;
80105bbd:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105bc2:	e9 46 01 00 00       	jmp    80105d0d <sys_open+0x184>
  if(omode & O_CREATE){
80105bc7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80105bca:	25 00 02 00 00       	and    $0x200,%eax
80105bcf:	85 c0                	test   %eax,%eax
80105bd1:	74 40                	je     80105c13 <sys_open+0x8a>
    begin_trans();
80105bd3:	e8 59 d7 ff ff       	call   80103331 <begin_trans>
    ip = create(path, T_FILE, 0, 0);
80105bd8:	8b 45 e8             	mov    -0x18(%ebp),%eax
80105bdb:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
80105be2:	00 
80105be3:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80105bea:	00 
80105beb:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
80105bf2:	00 
80105bf3:	89 04 24             	mov    %eax,(%esp)
80105bf6:	e8 ce fd ff ff       	call   801059c9 <create>
80105bfb:	89 45 f4             	mov    %eax,-0xc(%ebp)
    commit_trans();
80105bfe:	e8 77 d7 ff ff       	call   8010337a <commit_trans>
    if(ip == 0)
80105c03:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105c07:	75 5c                	jne    80105c65 <sys_open+0xdc>
      return -1;
80105c09:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105c0e:	e9 fa 00 00 00       	jmp    80105d0d <sys_open+0x184>
  } else {
    if((ip = namei(path)) == 0)
80105c13:	8b 45 e8             	mov    -0x18(%ebp),%eax
80105c16:	89 04 24             	mov    %eax,(%esp)
80105c19:	e8 fc c7 ff ff       	call   8010241a <namei>
80105c1e:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105c21:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105c25:	75 0a                	jne    80105c31 <sys_open+0xa8>
      return -1;
80105c27:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105c2c:	e9 dc 00 00 00       	jmp    80105d0d <sys_open+0x184>
    ilock(ip);
80105c31:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105c34:	89 04 24             	mov    %eax,(%esp)
80105c37:	e8 3c bc ff ff       	call   80101878 <ilock>
    if(ip->type == T_DIR && omode != O_RDONLY){
80105c3c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105c3f:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80105c43:	66 83 f8 01          	cmp    $0x1,%ax
80105c47:	75 1c                	jne    80105c65 <sys_open+0xdc>
80105c49:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80105c4c:	85 c0                	test   %eax,%eax
80105c4e:	74 15                	je     80105c65 <sys_open+0xdc>
      iunlockput(ip);
80105c50:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105c53:	89 04 24             	mov    %eax,(%esp)
80105c56:	e8 a1 be ff ff       	call   80101afc <iunlockput>
      return -1;
80105c5b:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105c60:	e9 a8 00 00 00       	jmp    80105d0d <sys_open+0x184>
    }
  }

  if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
80105c65:	e8 c2 b2 ff ff       	call   80100f2c <filealloc>
80105c6a:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105c6d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105c71:	74 14                	je     80105c87 <sys_open+0xfe>
80105c73:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105c76:	89 04 24             	mov    %eax,(%esp)
80105c79:	e8 43 f7 ff ff       	call   801053c1 <fdalloc>
80105c7e:	89 45 ec             	mov    %eax,-0x14(%ebp)
80105c81:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80105c85:	79 23                	jns    80105caa <sys_open+0x121>
    if(f)
80105c87:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105c8b:	74 0b                	je     80105c98 <sys_open+0x10f>
      fileclose(f);
80105c8d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105c90:	89 04 24             	mov    %eax,(%esp)
80105c93:	e8 3c b3 ff ff       	call   80100fd4 <fileclose>
    iunlockput(ip);
80105c98:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105c9b:	89 04 24             	mov    %eax,(%esp)
80105c9e:	e8 59 be ff ff       	call   80101afc <iunlockput>
    return -1;
80105ca3:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105ca8:	eb 63                	jmp    80105d0d <sys_open+0x184>
  }
  iunlock(ip);
80105caa:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105cad:	89 04 24             	mov    %eax,(%esp)
80105cb0:	e8 11 bd ff ff       	call   801019c6 <iunlock>

  f->type = FD_INODE;
80105cb5:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105cb8:	c7 00 02 00 00 00    	movl   $0x2,(%eax)
  f->ip = ip;
80105cbe:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105cc1:	8b 55 f4             	mov    -0xc(%ebp),%edx
80105cc4:	89 50 10             	mov    %edx,0x10(%eax)
  f->off = 0;
80105cc7:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105cca:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
  f->readable = !(omode & O_WRONLY);
80105cd1:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80105cd4:	83 e0 01             	and    $0x1,%eax
80105cd7:	85 c0                	test   %eax,%eax
80105cd9:	0f 94 c2             	sete   %dl
80105cdc:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105cdf:	88 50 08             	mov    %dl,0x8(%eax)
  f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
80105ce2:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80105ce5:	83 e0 01             	and    $0x1,%eax
80105ce8:	84 c0                	test   %al,%al
80105cea:	75 0a                	jne    80105cf6 <sys_open+0x16d>
80105cec:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80105cef:	83 e0 02             	and    $0x2,%eax
80105cf2:	85 c0                	test   %eax,%eax
80105cf4:	74 07                	je     80105cfd <sys_open+0x174>
80105cf6:	b8 01 00 00 00       	mov    $0x1,%eax
80105cfb:	eb 05                	jmp    80105d02 <sys_open+0x179>
80105cfd:	b8 00 00 00 00       	mov    $0x0,%eax
80105d02:	89 c2                	mov    %eax,%edx
80105d04:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105d07:	88 50 09             	mov    %dl,0x9(%eax)
  return fd;
80105d0a:	8b 45 ec             	mov    -0x14(%ebp),%eax
}
80105d0d:	c9                   	leave  
80105d0e:	c3                   	ret    

80105d0f <sys_mkdir>:

int
sys_mkdir(void)
{
80105d0f:	55                   	push   %ebp
80105d10:	89 e5                	mov    %esp,%ebp
80105d12:	83 ec 28             	sub    $0x28,%esp
  char *path;
  struct inode *ip;

  begin_trans();
80105d15:	e8 17 d6 ff ff       	call   80103331 <begin_trans>
  if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
80105d1a:	8d 45 f0             	lea    -0x10(%ebp),%eax
80105d1d:	89 44 24 04          	mov    %eax,0x4(%esp)
80105d21:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105d28:	e8 59 f5 ff ff       	call   80105286 <argstr>
80105d2d:	85 c0                	test   %eax,%eax
80105d2f:	78 2c                	js     80105d5d <sys_mkdir+0x4e>
80105d31:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105d34:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
80105d3b:	00 
80105d3c:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80105d43:	00 
80105d44:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80105d4b:	00 
80105d4c:	89 04 24             	mov    %eax,(%esp)
80105d4f:	e8 75 fc ff ff       	call   801059c9 <create>
80105d54:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105d57:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105d5b:	75 0c                	jne    80105d69 <sys_mkdir+0x5a>
    commit_trans();
80105d5d:	e8 18 d6 ff ff       	call   8010337a <commit_trans>
    return -1;
80105d62:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105d67:	eb 15                	jmp    80105d7e <sys_mkdir+0x6f>
  }
  iunlockput(ip);
80105d69:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105d6c:	89 04 24             	mov    %eax,(%esp)
80105d6f:	e8 88 bd ff ff       	call   80101afc <iunlockput>
  commit_trans();
80105d74:	e8 01 d6 ff ff       	call   8010337a <commit_trans>
  return 0;
80105d79:	b8 00 00 00 00       	mov    $0x0,%eax
}
80105d7e:	c9                   	leave  
80105d7f:	c3                   	ret    

80105d80 <sys_mknod>:

int
sys_mknod(void)
{
80105d80:	55                   	push   %ebp
80105d81:	89 e5                	mov    %esp,%ebp
80105d83:	83 ec 38             	sub    $0x38,%esp
  struct inode *ip;
  char *path;
  int len;
  int major, minor;

  begin_trans();
80105d86:	e8 a6 d5 ff ff       	call   80103331 <begin_trans>
  if((len=argstr(0, &path)) < 0 ||
80105d8b:	8d 45 ec             	lea    -0x14(%ebp),%eax
80105d8e:	89 44 24 04          	mov    %eax,0x4(%esp)
80105d92:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105d99:	e8 e8 f4 ff ff       	call   80105286 <argstr>
80105d9e:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105da1:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105da5:	78 5e                	js     80105e05 <sys_mknod+0x85>
     argint(1, &major) < 0 ||
80105da7:	8d 45 e8             	lea    -0x18(%ebp),%eax
80105daa:	89 44 24 04          	mov    %eax,0x4(%esp)
80105dae:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80105db5:	e8 3c f4 ff ff       	call   801051f6 <argint>
  char *path;
  int len;
  int major, minor;

  begin_trans();
  if((len=argstr(0, &path)) < 0 ||
80105dba:	85 c0                	test   %eax,%eax
80105dbc:	78 47                	js     80105e05 <sys_mknod+0x85>
     argint(1, &major) < 0 ||
     argint(2, &minor) < 0 ||
80105dbe:	8d 45 e4             	lea    -0x1c(%ebp),%eax
80105dc1:	89 44 24 04          	mov    %eax,0x4(%esp)
80105dc5:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
80105dcc:	e8 25 f4 ff ff       	call   801051f6 <argint>
  int len;
  int major, minor;

  begin_trans();
  if((len=argstr(0, &path)) < 0 ||
     argint(1, &major) < 0 ||
80105dd1:	85 c0                	test   %eax,%eax
80105dd3:	78 30                	js     80105e05 <sys_mknod+0x85>
     argint(2, &minor) < 0 ||
     (ip = create(path, T_DEV, major, minor)) == 0){
80105dd5:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80105dd8:	0f bf c8             	movswl %ax,%ecx
80105ddb:	8b 45 e8             	mov    -0x18(%ebp),%eax
80105dde:	0f bf d0             	movswl %ax,%edx
80105de1:	8b 45 ec             	mov    -0x14(%ebp),%eax
  int major, minor;

  begin_trans();
  if((len=argstr(0, &path)) < 0 ||
     argint(1, &major) < 0 ||
     argint(2, &minor) < 0 ||
80105de4:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
80105de8:	89 54 24 08          	mov    %edx,0x8(%esp)
80105dec:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
80105df3:	00 
80105df4:	89 04 24             	mov    %eax,(%esp)
80105df7:	e8 cd fb ff ff       	call   801059c9 <create>
80105dfc:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105dff:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105e03:	75 0c                	jne    80105e11 <sys_mknod+0x91>
     (ip = create(path, T_DEV, major, minor)) == 0){
    commit_trans();
80105e05:	e8 70 d5 ff ff       	call   8010337a <commit_trans>
    return -1;
80105e0a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105e0f:	eb 15                	jmp    80105e26 <sys_mknod+0xa6>
  }
  iunlockput(ip);
80105e11:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105e14:	89 04 24             	mov    %eax,(%esp)
80105e17:	e8 e0 bc ff ff       	call   80101afc <iunlockput>
  commit_trans();
80105e1c:	e8 59 d5 ff ff       	call   8010337a <commit_trans>
  return 0;
80105e21:	b8 00 00 00 00       	mov    $0x0,%eax
}
80105e26:	c9                   	leave  
80105e27:	c3                   	ret    

80105e28 <sys_chdir>:

int
sys_chdir(void)
{
80105e28:	55                   	push   %ebp
80105e29:	89 e5                	mov    %esp,%ebp
80105e2b:	83 ec 28             	sub    $0x28,%esp
  char *path;
  struct inode *ip;

  if(argstr(0, &path) < 0 || (ip = namei(path)) == 0)
80105e2e:	8d 45 f0             	lea    -0x10(%ebp),%eax
80105e31:	89 44 24 04          	mov    %eax,0x4(%esp)
80105e35:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105e3c:	e8 45 f4 ff ff       	call   80105286 <argstr>
80105e41:	85 c0                	test   %eax,%eax
80105e43:	78 14                	js     80105e59 <sys_chdir+0x31>
80105e45:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105e48:	89 04 24             	mov    %eax,(%esp)
80105e4b:	e8 ca c5 ff ff       	call   8010241a <namei>
80105e50:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105e53:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105e57:	75 07                	jne    80105e60 <sys_chdir+0x38>
    return -1;
80105e59:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105e5e:	eb 57                	jmp    80105eb7 <sys_chdir+0x8f>
  ilock(ip);
80105e60:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105e63:	89 04 24             	mov    %eax,(%esp)
80105e66:	e8 0d ba ff ff       	call   80101878 <ilock>
  if(ip->type != T_DIR){
80105e6b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105e6e:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80105e72:	66 83 f8 01          	cmp    $0x1,%ax
80105e76:	74 12                	je     80105e8a <sys_chdir+0x62>
    iunlockput(ip);
80105e78:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105e7b:	89 04 24             	mov    %eax,(%esp)
80105e7e:	e8 79 bc ff ff       	call   80101afc <iunlockput>
    return -1;
80105e83:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105e88:	eb 2d                	jmp    80105eb7 <sys_chdir+0x8f>
  }
  iunlock(ip);
80105e8a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105e8d:	89 04 24             	mov    %eax,(%esp)
80105e90:	e8 31 bb ff ff       	call   801019c6 <iunlock>
  iput(proc->cwd);
80105e95:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105e9b:	8b 40 68             	mov    0x68(%eax),%eax
80105e9e:	89 04 24             	mov    %eax,(%esp)
80105ea1:	e8 85 bb ff ff       	call   80101a2b <iput>
  proc->cwd = ip;
80105ea6:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105eac:	8b 55 f4             	mov    -0xc(%ebp),%edx
80105eaf:	89 50 68             	mov    %edx,0x68(%eax)
  return 0;
80105eb2:	b8 00 00 00 00       	mov    $0x0,%eax
}
80105eb7:	c9                   	leave  
80105eb8:	c3                   	ret    

80105eb9 <sys_exec>:

int
sys_exec(void)
{
80105eb9:	55                   	push   %ebp
80105eba:	89 e5                	mov    %esp,%ebp
80105ebc:	81 ec a8 00 00 00    	sub    $0xa8,%esp
  char *path, *argv[MAXARG];
  int i;
  uint uargv, uarg;

  if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
80105ec2:	8d 45 f0             	lea    -0x10(%ebp),%eax
80105ec5:	89 44 24 04          	mov    %eax,0x4(%esp)
80105ec9:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105ed0:	e8 b1 f3 ff ff       	call   80105286 <argstr>
80105ed5:	85 c0                	test   %eax,%eax
80105ed7:	78 1a                	js     80105ef3 <sys_exec+0x3a>
80105ed9:	8d 85 6c ff ff ff    	lea    -0x94(%ebp),%eax
80105edf:	89 44 24 04          	mov    %eax,0x4(%esp)
80105ee3:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80105eea:	e8 07 f3 ff ff       	call   801051f6 <argint>
80105eef:	85 c0                	test   %eax,%eax
80105ef1:	79 0a                	jns    80105efd <sys_exec+0x44>
    return -1;
80105ef3:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105ef8:	e9 cc 00 00 00       	jmp    80105fc9 <sys_exec+0x110>
  }
  memset(argv, 0, sizeof(argv));
80105efd:	c7 44 24 08 80 00 00 	movl   $0x80,0x8(%esp)
80105f04:	00 
80105f05:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80105f0c:	00 
80105f0d:	8d 85 70 ff ff ff    	lea    -0x90(%ebp),%eax
80105f13:	89 04 24             	mov    %eax,(%esp)
80105f16:	e8 7f ef ff ff       	call   80104e9a <memset>
  for(i=0;; i++){
80105f1b:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    if(i >= NELEM(argv))
80105f22:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105f25:	83 f8 1f             	cmp    $0x1f,%eax
80105f28:	76 0a                	jbe    80105f34 <sys_exec+0x7b>
      return -1;
80105f2a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105f2f:	e9 95 00 00 00       	jmp    80105fc9 <sys_exec+0x110>
    if(fetchint(uargv+4*i, (int*)&uarg) < 0)
80105f34:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105f37:	c1 e0 02             	shl    $0x2,%eax
80105f3a:	89 c2                	mov    %eax,%edx
80105f3c:	8b 85 6c ff ff ff    	mov    -0x94(%ebp),%eax
80105f42:	01 c2                	add    %eax,%edx
80105f44:	8d 85 68 ff ff ff    	lea    -0x98(%ebp),%eax
80105f4a:	89 44 24 04          	mov    %eax,0x4(%esp)
80105f4e:	89 14 24             	mov    %edx,(%esp)
80105f51:	e8 02 f2 ff ff       	call   80105158 <fetchint>
80105f56:	85 c0                	test   %eax,%eax
80105f58:	79 07                	jns    80105f61 <sys_exec+0xa8>
      return -1;
80105f5a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105f5f:	eb 68                	jmp    80105fc9 <sys_exec+0x110>
    if(uarg == 0){
80105f61:	8b 85 68 ff ff ff    	mov    -0x98(%ebp),%eax
80105f67:	85 c0                	test   %eax,%eax
80105f69:	75 26                	jne    80105f91 <sys_exec+0xd8>
      argv[i] = 0;
80105f6b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105f6e:	c7 84 85 70 ff ff ff 	movl   $0x0,-0x90(%ebp,%eax,4)
80105f75:	00 00 00 00 
      break;
80105f79:	90                   	nop
    }
    if(fetchstr(uarg, &argv[i]) < 0)
      return -1;
  }
  return exec(path, argv);
80105f7a:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105f7d:	8d 95 70 ff ff ff    	lea    -0x90(%ebp),%edx
80105f83:	89 54 24 04          	mov    %edx,0x4(%esp)
80105f87:	89 04 24             	mov    %eax,(%esp)
80105f8a:	e8 85 ab ff ff       	call   80100b14 <exec>
80105f8f:	eb 38                	jmp    80105fc9 <sys_exec+0x110>
      return -1;
    if(uarg == 0){
      argv[i] = 0;
      break;
    }
    if(fetchstr(uarg, &argv[i]) < 0)
80105f91:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105f94:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80105f9b:	8d 85 70 ff ff ff    	lea    -0x90(%ebp),%eax
80105fa1:	01 c2                	add    %eax,%edx
80105fa3:	8b 85 68 ff ff ff    	mov    -0x98(%ebp),%eax
80105fa9:	89 54 24 04          	mov    %edx,0x4(%esp)
80105fad:	89 04 24             	mov    %eax,(%esp)
80105fb0:	e8 dd f1 ff ff       	call   80105192 <fetchstr>
80105fb5:	85 c0                	test   %eax,%eax
80105fb7:	79 07                	jns    80105fc0 <sys_exec+0x107>
      return -1;
80105fb9:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105fbe:	eb 09                	jmp    80105fc9 <sys_exec+0x110>

  if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
    return -1;
  }
  memset(argv, 0, sizeof(argv));
  for(i=0;; i++){
80105fc0:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
      argv[i] = 0;
      break;
    }
    if(fetchstr(uarg, &argv[i]) < 0)
      return -1;
  }
80105fc4:	e9 59 ff ff ff       	jmp    80105f22 <sys_exec+0x69>
  return exec(path, argv);
}
80105fc9:	c9                   	leave  
80105fca:	c3                   	ret    

80105fcb <sys_pipe>:

int
sys_pipe(void)
{
80105fcb:	55                   	push   %ebp
80105fcc:	89 e5                	mov    %esp,%ebp
80105fce:	83 ec 38             	sub    $0x38,%esp
  int *fd;
  struct file *rf, *wf;
  int fd0, fd1;

  if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
80105fd1:	c7 44 24 08 08 00 00 	movl   $0x8,0x8(%esp)
80105fd8:	00 
80105fd9:	8d 45 ec             	lea    -0x14(%ebp),%eax
80105fdc:	89 44 24 04          	mov    %eax,0x4(%esp)
80105fe0:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105fe7:	e8 38 f2 ff ff       	call   80105224 <argptr>
80105fec:	85 c0                	test   %eax,%eax
80105fee:	79 0a                	jns    80105ffa <sys_pipe+0x2f>
    return -1;
80105ff0:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105ff5:	e9 9b 00 00 00       	jmp    80106095 <sys_pipe+0xca>
  if(pipealloc(&rf, &wf) < 0)
80105ffa:	8d 45 e4             	lea    -0x1c(%ebp),%eax
80105ffd:	89 44 24 04          	mov    %eax,0x4(%esp)
80106001:	8d 45 e8             	lea    -0x18(%ebp),%eax
80106004:	89 04 24             	mov    %eax,(%esp)
80106007:	e8 6c dd ff ff       	call   80103d78 <pipealloc>
8010600c:	85 c0                	test   %eax,%eax
8010600e:	79 07                	jns    80106017 <sys_pipe+0x4c>
    return -1;
80106010:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106015:	eb 7e                	jmp    80106095 <sys_pipe+0xca>
  fd0 = -1;
80106017:	c7 45 f4 ff ff ff ff 	movl   $0xffffffff,-0xc(%ebp)
  if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
8010601e:	8b 45 e8             	mov    -0x18(%ebp),%eax
80106021:	89 04 24             	mov    %eax,(%esp)
80106024:	e8 98 f3 ff ff       	call   801053c1 <fdalloc>
80106029:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010602c:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80106030:	78 14                	js     80106046 <sys_pipe+0x7b>
80106032:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80106035:	89 04 24             	mov    %eax,(%esp)
80106038:	e8 84 f3 ff ff       	call   801053c1 <fdalloc>
8010603d:	89 45 f0             	mov    %eax,-0x10(%ebp)
80106040:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80106044:	79 37                	jns    8010607d <sys_pipe+0xb2>
    if(fd0 >= 0)
80106046:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010604a:	78 14                	js     80106060 <sys_pipe+0x95>
      proc->ofile[fd0] = 0;
8010604c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106052:	8b 55 f4             	mov    -0xc(%ebp),%edx
80106055:	83 c2 08             	add    $0x8,%edx
80106058:	c7 44 90 08 00 00 00 	movl   $0x0,0x8(%eax,%edx,4)
8010605f:	00 
    fileclose(rf);
80106060:	8b 45 e8             	mov    -0x18(%ebp),%eax
80106063:	89 04 24             	mov    %eax,(%esp)
80106066:	e8 69 af ff ff       	call   80100fd4 <fileclose>
    fileclose(wf);
8010606b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
8010606e:	89 04 24             	mov    %eax,(%esp)
80106071:	e8 5e af ff ff       	call   80100fd4 <fileclose>
    return -1;
80106076:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010607b:	eb 18                	jmp    80106095 <sys_pipe+0xca>
  }
  fd[0] = fd0;
8010607d:	8b 45 ec             	mov    -0x14(%ebp),%eax
80106080:	8b 55 f4             	mov    -0xc(%ebp),%edx
80106083:	89 10                	mov    %edx,(%eax)
  fd[1] = fd1;
80106085:	8b 45 ec             	mov    -0x14(%ebp),%eax
80106088:	8d 50 04             	lea    0x4(%eax),%edx
8010608b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010608e:	89 02                	mov    %eax,(%edx)
  return 0;
80106090:	b8 00 00 00 00       	mov    $0x0,%eax
}
80106095:	c9                   	leave  
80106096:	c3                   	ret    
	...

80106098 <sys_fork>:
#include "mmu.h"
#include "proc.h"

int
sys_fork(void)
{
80106098:	55                   	push   %ebp
80106099:	89 e5                	mov    %esp,%ebp
8010609b:	83 ec 08             	sub    $0x8,%esp
  return fork();
8010609e:	e8 88 e3 ff ff       	call   8010442b <fork>
}
801060a3:	c9                   	leave  
801060a4:	c3                   	ret    

801060a5 <sys_exit>:

int
sys_exit(void)
{
801060a5:	55                   	push   %ebp
801060a6:	89 e5                	mov    %esp,%ebp
801060a8:	83 ec 08             	sub    $0x8,%esp
  exit();
801060ab:	e8 de e4 ff ff       	call   8010458e <exit>
  return 0;  // not reached
801060b0:	b8 00 00 00 00       	mov    $0x0,%eax
}
801060b5:	c9                   	leave  
801060b6:	c3                   	ret    

801060b7 <sys_wait>:

int
sys_wait(void)
{
801060b7:	55                   	push   %ebp
801060b8:	89 e5                	mov    %esp,%ebp
801060ba:	83 ec 08             	sub    $0x8,%esp
  return wait();
801060bd:	e8 e4 e5 ff ff       	call   801046a6 <wait>
}
801060c2:	c9                   	leave  
801060c3:	c3                   	ret    

801060c4 <sys_kill>:

int
sys_kill(void)
{
801060c4:	55                   	push   %ebp
801060c5:	89 e5                	mov    %esp,%ebp
801060c7:	83 ec 28             	sub    $0x28,%esp
  int pid;

  if(argint(0, &pid) < 0)
801060ca:	8d 45 f4             	lea    -0xc(%ebp),%eax
801060cd:	89 44 24 04          	mov    %eax,0x4(%esp)
801060d1:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
801060d8:	e8 19 f1 ff ff       	call   801051f6 <argint>
801060dd:	85 c0                	test   %eax,%eax
801060df:	79 07                	jns    801060e8 <sys_kill+0x24>
    return -1;
801060e1:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801060e6:	eb 0b                	jmp    801060f3 <sys_kill+0x2f>
  return kill(pid);
801060e8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801060eb:	89 04 24             	mov    %eax,(%esp)
801060ee:	e8 9a e9 ff ff       	call   80104a8d <kill>
}
801060f3:	c9                   	leave  
801060f4:	c3                   	ret    

801060f5 <sys_getpid>:

int
sys_getpid(void)
{
801060f5:	55                   	push   %ebp
801060f6:	89 e5                	mov    %esp,%ebp
  return proc->pid;
801060f8:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801060fe:	8b 40 10             	mov    0x10(%eax),%eax
}
80106101:	5d                   	pop    %ebp
80106102:	c3                   	ret    

80106103 <sys_sbrk>:

int
sys_sbrk(void)
{
80106103:	55                   	push   %ebp
80106104:	89 e5                	mov    %esp,%ebp
80106106:	83 ec 28             	sub    $0x28,%esp
  int addr;
  int n;
  
  cprintf("[%s] call sbrk with size [%x]\n",proc->name, proc->sz);
80106109:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010610f:	8b 00                	mov    (%eax),%eax
80106111:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
80106118:	83 c2 6c             	add    $0x6c,%edx
8010611b:	89 44 24 08          	mov    %eax,0x8(%esp)
8010611f:	89 54 24 04          	mov    %edx,0x4(%esp)
80106123:	c7 04 24 c0 8d 10 80 	movl   $0x80108dc0,(%esp)
8010612a:	e8 72 a2 ff ff       	call   801003a1 <cprintf>

  if(argint(0, &n) < 0)
8010612f:	8d 45 f0             	lea    -0x10(%ebp),%eax
80106132:	89 44 24 04          	mov    %eax,0x4(%esp)
80106136:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
8010613d:	e8 b4 f0 ff ff       	call   801051f6 <argint>
80106142:	85 c0                	test   %eax,%eax
80106144:	79 07                	jns    8010614d <sys_sbrk+0x4a>
    return -1;
80106146:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010614b:	eb 24                	jmp    80106171 <sys_sbrk+0x6e>
  addr = proc->sz;
8010614d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106153:	8b 00                	mov    (%eax),%eax
80106155:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(growproc(n) < 0)
80106158:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010615b:	89 04 24             	mov    %eax,(%esp)
8010615e:	e8 23 e2 ff ff       	call   80104386 <growproc>
80106163:	85 c0                	test   %eax,%eax
80106165:	79 07                	jns    8010616e <sys_sbrk+0x6b>
    return -1;
80106167:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010616c:	eb 03                	jmp    80106171 <sys_sbrk+0x6e>
  return addr;
8010616e:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80106171:	c9                   	leave  
80106172:	c3                   	ret    

80106173 <sys_sleep>:

int
sys_sleep(void)
{
80106173:	55                   	push   %ebp
80106174:	89 e5                	mov    %esp,%ebp
80106176:	83 ec 28             	sub    $0x28,%esp
  int n;
  uint ticks0;

  if(argint(0, &n) < 0)
80106179:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010617c:	89 44 24 04          	mov    %eax,0x4(%esp)
80106180:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106187:	e8 6a f0 ff ff       	call   801051f6 <argint>
8010618c:	85 c0                	test   %eax,%eax
8010618e:	79 07                	jns    80106197 <sys_sleep+0x24>
    return -1;
80106190:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106195:	eb 6c                	jmp    80106203 <sys_sleep+0x90>
  acquire(&tickslock);
80106197:	c7 04 24 80 2e 11 80 	movl   $0x80112e80,(%esp)
8010619e:	e8 a8 ea ff ff       	call   80104c4b <acquire>
  ticks0 = ticks;
801061a3:	a1 c0 36 11 80       	mov    0x801136c0,%eax
801061a8:	89 45 f4             	mov    %eax,-0xc(%ebp)
  while(ticks - ticks0 < n){
801061ab:	eb 34                	jmp    801061e1 <sys_sleep+0x6e>
    if(proc->killed){
801061ad:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801061b3:	8b 40 24             	mov    0x24(%eax),%eax
801061b6:	85 c0                	test   %eax,%eax
801061b8:	74 13                	je     801061cd <sys_sleep+0x5a>
      release(&tickslock);
801061ba:	c7 04 24 80 2e 11 80 	movl   $0x80112e80,(%esp)
801061c1:	e8 e7 ea ff ff       	call   80104cad <release>
      return -1;
801061c6:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801061cb:	eb 36                	jmp    80106203 <sys_sleep+0x90>
    }
    sleep(&ticks, &tickslock);
801061cd:	c7 44 24 04 80 2e 11 	movl   $0x80112e80,0x4(%esp)
801061d4:	80 
801061d5:	c7 04 24 c0 36 11 80 	movl   $0x801136c0,(%esp)
801061dc:	e8 a8 e7 ff ff       	call   80104989 <sleep>

  if(argint(0, &n) < 0)
    return -1;
  acquire(&tickslock);
  ticks0 = ticks;
  while(ticks - ticks0 < n){
801061e1:	a1 c0 36 11 80       	mov    0x801136c0,%eax
801061e6:	89 c2                	mov    %eax,%edx
801061e8:	2b 55 f4             	sub    -0xc(%ebp),%edx
801061eb:	8b 45 f0             	mov    -0x10(%ebp),%eax
801061ee:	39 c2                	cmp    %eax,%edx
801061f0:	72 bb                	jb     801061ad <sys_sleep+0x3a>
      release(&tickslock);
      return -1;
    }
    sleep(&ticks, &tickslock);
  }
  release(&tickslock);
801061f2:	c7 04 24 80 2e 11 80 	movl   $0x80112e80,(%esp)
801061f9:	e8 af ea ff ff       	call   80104cad <release>
  return 0;
801061fe:	b8 00 00 00 00       	mov    $0x0,%eax
}
80106203:	c9                   	leave  
80106204:	c3                   	ret    

80106205 <sys_uptime>:

// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
80106205:	55                   	push   %ebp
80106206:	89 e5                	mov    %esp,%ebp
80106208:	83 ec 28             	sub    $0x28,%esp
  uint xticks;

  acquire(&tickslock);
8010620b:	c7 04 24 80 2e 11 80 	movl   $0x80112e80,(%esp)
80106212:	e8 34 ea ff ff       	call   80104c4b <acquire>
  xticks = ticks;
80106217:	a1 c0 36 11 80       	mov    0x801136c0,%eax
8010621c:	89 45 f4             	mov    %eax,-0xc(%ebp)
  release(&tickslock);
8010621f:	c7 04 24 80 2e 11 80 	movl   $0x80112e80,(%esp)
80106226:	e8 82 ea ff ff       	call   80104cad <release>
  return xticks;
8010622b:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
8010622e:	c9                   	leave  
8010622f:	c3                   	ret    

80106230 <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
80106230:	55                   	push   %ebp
80106231:	89 e5                	mov    %esp,%ebp
80106233:	83 ec 08             	sub    $0x8,%esp
80106236:	8b 55 08             	mov    0x8(%ebp),%edx
80106239:	8b 45 0c             	mov    0xc(%ebp),%eax
8010623c:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
80106240:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80106243:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80106247:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
8010624b:	ee                   	out    %al,(%dx)
}
8010624c:	c9                   	leave  
8010624d:	c3                   	ret    

8010624e <timerinit>:
#define TIMER_RATEGEN   0x04    // mode 2, rate generator
#define TIMER_16BIT     0x30    // r/w counter 16 bits, LSB first

void
timerinit(void)
{
8010624e:	55                   	push   %ebp
8010624f:	89 e5                	mov    %esp,%ebp
80106251:	83 ec 18             	sub    $0x18,%esp
  // Interrupt 100 times/sec.
  outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
80106254:	c7 44 24 04 34 00 00 	movl   $0x34,0x4(%esp)
8010625b:	00 
8010625c:	c7 04 24 43 00 00 00 	movl   $0x43,(%esp)
80106263:	e8 c8 ff ff ff       	call   80106230 <outb>
  outb(IO_TIMER1, TIMER_DIV(100) % 256);
80106268:	c7 44 24 04 9c 00 00 	movl   $0x9c,0x4(%esp)
8010626f:	00 
80106270:	c7 04 24 40 00 00 00 	movl   $0x40,(%esp)
80106277:	e8 b4 ff ff ff       	call   80106230 <outb>
  outb(IO_TIMER1, TIMER_DIV(100) / 256);
8010627c:	c7 44 24 04 2e 00 00 	movl   $0x2e,0x4(%esp)
80106283:	00 
80106284:	c7 04 24 40 00 00 00 	movl   $0x40,(%esp)
8010628b:	e8 a0 ff ff ff       	call   80106230 <outb>
  picenable(IRQ_TIMER);
80106290:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106297:	e8 65 d9 ff ff       	call   80103c01 <picenable>
}
8010629c:	c9                   	leave  
8010629d:	c3                   	ret    
	...

801062a0 <alltraps>:

  # vectors.S sends all traps here.
.globl alltraps
alltraps:
  # Build trap frame.
  pushl %ds
801062a0:	1e                   	push   %ds
  pushl %es
801062a1:	06                   	push   %es
  pushl %fs
801062a2:	0f a0                	push   %fs
  pushl %gs
801062a4:	0f a8                	push   %gs
  pushal
801062a6:	60                   	pusha  
  
  # Set up data and per-cpu segments.
  movw $(SEG_KDATA<<3), %ax
801062a7:	66 b8 10 00          	mov    $0x10,%ax
  movw %ax, %ds
801062ab:	8e d8                	mov    %eax,%ds
  movw %ax, %es
801062ad:	8e c0                	mov    %eax,%es
  movw $(SEG_KCPU<<3), %ax
801062af:	66 b8 18 00          	mov    $0x18,%ax
  movw %ax, %fs
801062b3:	8e e0                	mov    %eax,%fs
  movw %ax, %gs
801062b5:	8e e8                	mov    %eax,%gs

  # Call trap(tf), where tf=%esp
  pushl %esp
801062b7:	54                   	push   %esp
  call trap
801062b8:	e8 de 01 00 00       	call   8010649b <trap>
  addl $4, %esp
801062bd:	83 c4 04             	add    $0x4,%esp

801062c0 <trapret>:

  # Return falls through to trapret...
.globl trapret
trapret:
  popal
801062c0:	61                   	popa   
  popl %gs
801062c1:	0f a9                	pop    %gs
  popl %fs
801062c3:	0f a1                	pop    %fs
  popl %es
801062c5:	07                   	pop    %es
  popl %ds
801062c6:	1f                   	pop    %ds
  addl $0x8, %esp  # trapno and errcode
801062c7:	83 c4 08             	add    $0x8,%esp
  iret
801062ca:	cf                   	iret   
	...

801062cc <lidt>:

struct gatedesc;

static inline void
lidt(struct gatedesc *p, int size)
{
801062cc:	55                   	push   %ebp
801062cd:	89 e5                	mov    %esp,%ebp
801062cf:	83 ec 10             	sub    $0x10,%esp
  volatile ushort pd[3];

  pd[0] = size-1;
801062d2:	8b 45 0c             	mov    0xc(%ebp),%eax
801062d5:	83 e8 01             	sub    $0x1,%eax
801062d8:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
  pd[1] = (uint)p;
801062dc:	8b 45 08             	mov    0x8(%ebp),%eax
801062df:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  pd[2] = (uint)p >> 16;
801062e3:	8b 45 08             	mov    0x8(%ebp),%eax
801062e6:	c1 e8 10             	shr    $0x10,%eax
801062e9:	66 89 45 fe          	mov    %ax,-0x2(%ebp)

  asm volatile("lidt (%0)" : : "r" (pd));
801062ed:	8d 45 fa             	lea    -0x6(%ebp),%eax
801062f0:	0f 01 18             	lidtl  (%eax)
}
801062f3:	c9                   	leave  
801062f4:	c3                   	ret    

801062f5 <rcr2>:
  return result;
}

static inline uint
rcr2(void)
{
801062f5:	55                   	push   %ebp
801062f6:	89 e5                	mov    %esp,%ebp
801062f8:	53                   	push   %ebx
801062f9:	83 ec 10             	sub    $0x10,%esp
  uint val;
  asm volatile("movl %%cr2,%0" : "=r" (val));
801062fc:	0f 20 d3             	mov    %cr2,%ebx
801062ff:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  return val;
80106302:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80106305:	83 c4 10             	add    $0x10,%esp
80106308:	5b                   	pop    %ebx
80106309:	5d                   	pop    %ebp
8010630a:	c3                   	ret    

8010630b <tvinit>:
struct spinlock tickslock;
uint ticks;

void
tvinit(void)
{
8010630b:	55                   	push   %ebp
8010630c:	89 e5                	mov    %esp,%ebp
8010630e:	83 ec 28             	sub    $0x28,%esp
  int i;

  for(i = 0; i < 256; i++)
80106311:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80106318:	e9 c3 00 00 00       	jmp    801063e0 <tvinit+0xd5>
    SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
8010631d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106320:	8b 04 85 98 c0 10 80 	mov    -0x7fef3f68(,%eax,4),%eax
80106327:	89 c2                	mov    %eax,%edx
80106329:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010632c:	66 89 14 c5 c0 2e 11 	mov    %dx,-0x7feed140(,%eax,8)
80106333:	80 
80106334:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106337:	66 c7 04 c5 c2 2e 11 	movw   $0x8,-0x7feed13e(,%eax,8)
8010633e:	80 08 00 
80106341:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106344:	0f b6 14 c5 c4 2e 11 	movzbl -0x7feed13c(,%eax,8),%edx
8010634b:	80 
8010634c:	83 e2 e0             	and    $0xffffffe0,%edx
8010634f:	88 14 c5 c4 2e 11 80 	mov    %dl,-0x7feed13c(,%eax,8)
80106356:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106359:	0f b6 14 c5 c4 2e 11 	movzbl -0x7feed13c(,%eax,8),%edx
80106360:	80 
80106361:	83 e2 1f             	and    $0x1f,%edx
80106364:	88 14 c5 c4 2e 11 80 	mov    %dl,-0x7feed13c(,%eax,8)
8010636b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010636e:	0f b6 14 c5 c5 2e 11 	movzbl -0x7feed13b(,%eax,8),%edx
80106375:	80 
80106376:	83 e2 f0             	and    $0xfffffff0,%edx
80106379:	83 ca 0e             	or     $0xe,%edx
8010637c:	88 14 c5 c5 2e 11 80 	mov    %dl,-0x7feed13b(,%eax,8)
80106383:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106386:	0f b6 14 c5 c5 2e 11 	movzbl -0x7feed13b(,%eax,8),%edx
8010638d:	80 
8010638e:	83 e2 ef             	and    $0xffffffef,%edx
80106391:	88 14 c5 c5 2e 11 80 	mov    %dl,-0x7feed13b(,%eax,8)
80106398:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010639b:	0f b6 14 c5 c5 2e 11 	movzbl -0x7feed13b(,%eax,8),%edx
801063a2:	80 
801063a3:	83 e2 9f             	and    $0xffffff9f,%edx
801063a6:	88 14 c5 c5 2e 11 80 	mov    %dl,-0x7feed13b(,%eax,8)
801063ad:	8b 45 f4             	mov    -0xc(%ebp),%eax
801063b0:	0f b6 14 c5 c5 2e 11 	movzbl -0x7feed13b(,%eax,8),%edx
801063b7:	80 
801063b8:	83 ca 80             	or     $0xffffff80,%edx
801063bb:	88 14 c5 c5 2e 11 80 	mov    %dl,-0x7feed13b(,%eax,8)
801063c2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801063c5:	8b 04 85 98 c0 10 80 	mov    -0x7fef3f68(,%eax,4),%eax
801063cc:	c1 e8 10             	shr    $0x10,%eax
801063cf:	89 c2                	mov    %eax,%edx
801063d1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801063d4:	66 89 14 c5 c6 2e 11 	mov    %dx,-0x7feed13a(,%eax,8)
801063db:	80 
void
tvinit(void)
{
  int i;

  for(i = 0; i < 256; i++)
801063dc:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801063e0:	81 7d f4 ff 00 00 00 	cmpl   $0xff,-0xc(%ebp)
801063e7:	0f 8e 30 ff ff ff    	jle    8010631d <tvinit+0x12>
    SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
  SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
801063ed:	a1 98 c1 10 80       	mov    0x8010c198,%eax
801063f2:	66 a3 c0 30 11 80    	mov    %ax,0x801130c0
801063f8:	66 c7 05 c2 30 11 80 	movw   $0x8,0x801130c2
801063ff:	08 00 
80106401:	0f b6 05 c4 30 11 80 	movzbl 0x801130c4,%eax
80106408:	83 e0 e0             	and    $0xffffffe0,%eax
8010640b:	a2 c4 30 11 80       	mov    %al,0x801130c4
80106410:	0f b6 05 c4 30 11 80 	movzbl 0x801130c4,%eax
80106417:	83 e0 1f             	and    $0x1f,%eax
8010641a:	a2 c4 30 11 80       	mov    %al,0x801130c4
8010641f:	0f b6 05 c5 30 11 80 	movzbl 0x801130c5,%eax
80106426:	83 c8 0f             	or     $0xf,%eax
80106429:	a2 c5 30 11 80       	mov    %al,0x801130c5
8010642e:	0f b6 05 c5 30 11 80 	movzbl 0x801130c5,%eax
80106435:	83 e0 ef             	and    $0xffffffef,%eax
80106438:	a2 c5 30 11 80       	mov    %al,0x801130c5
8010643d:	0f b6 05 c5 30 11 80 	movzbl 0x801130c5,%eax
80106444:	83 c8 60             	or     $0x60,%eax
80106447:	a2 c5 30 11 80       	mov    %al,0x801130c5
8010644c:	0f b6 05 c5 30 11 80 	movzbl 0x801130c5,%eax
80106453:	83 c8 80             	or     $0xffffff80,%eax
80106456:	a2 c5 30 11 80       	mov    %al,0x801130c5
8010645b:	a1 98 c1 10 80       	mov    0x8010c198,%eax
80106460:	c1 e8 10             	shr    $0x10,%eax
80106463:	66 a3 c6 30 11 80    	mov    %ax,0x801130c6
  
  initlock(&tickslock, "time");
80106469:	c7 44 24 04 e0 8d 10 	movl   $0x80108de0,0x4(%esp)
80106470:	80 
80106471:	c7 04 24 80 2e 11 80 	movl   $0x80112e80,(%esp)
80106478:	e8 ad e7 ff ff       	call   80104c2a <initlock>
}
8010647d:	c9                   	leave  
8010647e:	c3                   	ret    

8010647f <idtinit>:

void
idtinit(void)
{
8010647f:	55                   	push   %ebp
80106480:	89 e5                	mov    %esp,%ebp
80106482:	83 ec 08             	sub    $0x8,%esp
  lidt(idt, sizeof(idt));
80106485:	c7 44 24 04 00 08 00 	movl   $0x800,0x4(%esp)
8010648c:	00 
8010648d:	c7 04 24 c0 2e 11 80 	movl   $0x80112ec0,(%esp)
80106494:	e8 33 fe ff ff       	call   801062cc <lidt>
}
80106499:	c9                   	leave  
8010649a:	c3                   	ret    

8010649b <trap>:

//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
8010649b:	55                   	push   %ebp
8010649c:	89 e5                	mov    %esp,%ebp
8010649e:	57                   	push   %edi
8010649f:	56                   	push   %esi
801064a0:	53                   	push   %ebx
801064a1:	83 ec 3c             	sub    $0x3c,%esp
  if(tf->trapno == T_SYSCALL){
801064a4:	8b 45 08             	mov    0x8(%ebp),%eax
801064a7:	8b 40 30             	mov    0x30(%eax),%eax
801064aa:	83 f8 40             	cmp    $0x40,%eax
801064ad:	75 3e                	jne    801064ed <trap+0x52>
    if(proc->killed)
801064af:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801064b5:	8b 40 24             	mov    0x24(%eax),%eax
801064b8:	85 c0                	test   %eax,%eax
801064ba:	74 05                	je     801064c1 <trap+0x26>
      exit();
801064bc:	e8 cd e0 ff ff       	call   8010458e <exit>
    proc->tf = tf;
801064c1:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801064c7:	8b 55 08             	mov    0x8(%ebp),%edx
801064ca:	89 50 18             	mov    %edx,0x18(%eax)
    syscall();
801064cd:	e8 eb ed ff ff       	call   801052bd <syscall>
    if(proc->killed)
801064d2:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801064d8:	8b 40 24             	mov    0x24(%eax),%eax
801064db:	85 c0                	test   %eax,%eax
801064dd:	0f 84 34 02 00 00    	je     80106717 <trap+0x27c>
      exit();
801064e3:	e8 a6 e0 ff ff       	call   8010458e <exit>
    return;
801064e8:	e9 2a 02 00 00       	jmp    80106717 <trap+0x27c>
  }

  switch(tf->trapno){
801064ed:	8b 45 08             	mov    0x8(%ebp),%eax
801064f0:	8b 40 30             	mov    0x30(%eax),%eax
801064f3:	83 e8 20             	sub    $0x20,%eax
801064f6:	83 f8 1f             	cmp    $0x1f,%eax
801064f9:	0f 87 bc 00 00 00    	ja     801065bb <trap+0x120>
801064ff:	8b 04 85 88 8e 10 80 	mov    -0x7fef7178(,%eax,4),%eax
80106506:	ff e0                	jmp    *%eax
  case T_IRQ0 + IRQ_TIMER:
    if(cpu->id == 0){
80106508:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
8010650e:	0f b6 00             	movzbl (%eax),%eax
80106511:	84 c0                	test   %al,%al
80106513:	75 31                	jne    80106546 <trap+0xab>
      acquire(&tickslock);
80106515:	c7 04 24 80 2e 11 80 	movl   $0x80112e80,(%esp)
8010651c:	e8 2a e7 ff ff       	call   80104c4b <acquire>
      ticks++;
80106521:	a1 c0 36 11 80       	mov    0x801136c0,%eax
80106526:	83 c0 01             	add    $0x1,%eax
80106529:	a3 c0 36 11 80       	mov    %eax,0x801136c0
      wakeup(&ticks);
8010652e:	c7 04 24 c0 36 11 80 	movl   $0x801136c0,(%esp)
80106535:	e8 28 e5 ff ff       	call   80104a62 <wakeup>
      release(&tickslock);
8010653a:	c7 04 24 80 2e 11 80 	movl   $0x80112e80,(%esp)
80106541:	e8 67 e7 ff ff       	call   80104cad <release>
    }
    lapiceoi();
80106546:	e8 b2 ca ff ff       	call   80102ffd <lapiceoi>
    break;
8010654b:	e9 41 01 00 00       	jmp    80106691 <trap+0x1f6>
  case T_IRQ0 + IRQ_IDE:
    ideintr();
80106550:	e8 ac c1 ff ff       	call   80102701 <ideintr>
    lapiceoi();
80106555:	e8 a3 ca ff ff       	call   80102ffd <lapiceoi>
    break;
8010655a:	e9 32 01 00 00       	jmp    80106691 <trap+0x1f6>
  case T_IRQ0 + IRQ_IDE+1:
    // Bochs generates spurious IDE1 interrupts.
    break;
  case T_IRQ0 + IRQ_KBD:
    kbdintr();
8010655f:	e8 77 c8 ff ff       	call   80102ddb <kbdintr>
    lapiceoi();
80106564:	e8 94 ca ff ff       	call   80102ffd <lapiceoi>
    break;
80106569:	e9 23 01 00 00       	jmp    80106691 <trap+0x1f6>
  case T_IRQ0 + IRQ_COM1:
    uartintr();
8010656e:	e8 a9 03 00 00       	call   8010691c <uartintr>
    lapiceoi();
80106573:	e8 85 ca ff ff       	call   80102ffd <lapiceoi>
    break;
80106578:	e9 14 01 00 00       	jmp    80106691 <trap+0x1f6>
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
            cpu->id, tf->cs, tf->eip);
8010657d:	8b 45 08             	mov    0x8(%ebp),%eax
    uartintr();
    lapiceoi();
    break;
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
80106580:	8b 48 38             	mov    0x38(%eax),%ecx
            cpu->id, tf->cs, tf->eip);
80106583:	8b 45 08             	mov    0x8(%ebp),%eax
80106586:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
    uartintr();
    lapiceoi();
    break;
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
8010658a:	0f b7 d0             	movzwl %ax,%edx
            cpu->id, tf->cs, tf->eip);
8010658d:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80106593:	0f b6 00             	movzbl (%eax),%eax
    uartintr();
    lapiceoi();
    break;
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
80106596:	0f b6 c0             	movzbl %al,%eax
80106599:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
8010659d:	89 54 24 08          	mov    %edx,0x8(%esp)
801065a1:	89 44 24 04          	mov    %eax,0x4(%esp)
801065a5:	c7 04 24 e8 8d 10 80 	movl   $0x80108de8,(%esp)
801065ac:	e8 f0 9d ff ff       	call   801003a1 <cprintf>
            cpu->id, tf->cs, tf->eip);
    lapiceoi();
801065b1:	e8 47 ca ff ff       	call   80102ffd <lapiceoi>
    break;
801065b6:	e9 d6 00 00 00       	jmp    80106691 <trap+0x1f6>
   
  //PAGEBREAK: 13
  default:
    if(proc == 0 || (tf->cs&3) == 0){
801065bb:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801065c1:	85 c0                	test   %eax,%eax
801065c3:	74 11                	je     801065d6 <trap+0x13b>
801065c5:	8b 45 08             	mov    0x8(%ebp),%eax
801065c8:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
801065cc:	0f b7 c0             	movzwl %ax,%eax
801065cf:	83 e0 03             	and    $0x3,%eax
801065d2:	85 c0                	test   %eax,%eax
801065d4:	75 46                	jne    8010661c <trap+0x181>
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
801065d6:	e8 1a fd ff ff       	call   801062f5 <rcr2>
              tf->trapno, cpu->id, tf->eip, rcr2());
801065db:	8b 55 08             	mov    0x8(%ebp),%edx
   
  //PAGEBREAK: 13
  default:
    if(proc == 0 || (tf->cs&3) == 0){
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
801065de:	8b 5a 38             	mov    0x38(%edx),%ebx
              tf->trapno, cpu->id, tf->eip, rcr2());
801065e1:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
801065e8:	0f b6 12             	movzbl (%edx),%edx
   
  //PAGEBREAK: 13
  default:
    if(proc == 0 || (tf->cs&3) == 0){
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
801065eb:	0f b6 ca             	movzbl %dl,%ecx
              tf->trapno, cpu->id, tf->eip, rcr2());
801065ee:	8b 55 08             	mov    0x8(%ebp),%edx
   
  //PAGEBREAK: 13
  default:
    if(proc == 0 || (tf->cs&3) == 0){
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
801065f1:	8b 52 30             	mov    0x30(%edx),%edx
801065f4:	89 44 24 10          	mov    %eax,0x10(%esp)
801065f8:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
801065fc:	89 4c 24 08          	mov    %ecx,0x8(%esp)
80106600:	89 54 24 04          	mov    %edx,0x4(%esp)
80106604:	c7 04 24 0c 8e 10 80 	movl   $0x80108e0c,(%esp)
8010660b:	e8 91 9d ff ff       	call   801003a1 <cprintf>
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
80106610:	c7 04 24 3e 8e 10 80 	movl   $0x80108e3e,(%esp)
80106617:	e8 39 9f ff ff       	call   80100555 <panic>
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
8010661c:	e8 d4 fc ff ff       	call   801062f5 <rcr2>
80106621:	89 c2                	mov    %eax,%edx
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
80106623:	8b 45 08             	mov    0x8(%ebp),%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80106626:	8b 78 38             	mov    0x38(%eax),%edi
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
80106629:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
8010662f:	0f b6 00             	movzbl (%eax),%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80106632:	0f b6 f0             	movzbl %al,%esi
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
80106635:	8b 45 08             	mov    0x8(%ebp),%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80106638:	8b 58 34             	mov    0x34(%eax),%ebx
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
8010663b:	8b 45 08             	mov    0x8(%ebp),%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
8010663e:	8b 48 30             	mov    0x30(%eax),%ecx
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
80106641:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106647:	83 c0 6c             	add    $0x6c,%eax
8010664a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
8010664d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80106653:	8b 40 10             	mov    0x10(%eax),%eax
80106656:	89 54 24 1c          	mov    %edx,0x1c(%esp)
8010665a:	89 7c 24 18          	mov    %edi,0x18(%esp)
8010665e:	89 74 24 14          	mov    %esi,0x14(%esp)
80106662:	89 5c 24 10          	mov    %ebx,0x10(%esp)
80106666:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
8010666a:	8b 55 e4             	mov    -0x1c(%ebp),%edx
8010666d:	89 54 24 08          	mov    %edx,0x8(%esp)
80106671:	89 44 24 04          	mov    %eax,0x4(%esp)
80106675:	c7 04 24 44 8e 10 80 	movl   $0x80108e44,(%esp)
8010667c:	e8 20 9d ff ff       	call   801003a1 <cprintf>
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
            rcr2());
    proc->killed = 1;
80106681:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106687:	c7 40 24 01 00 00 00 	movl   $0x1,0x24(%eax)
8010668e:	eb 01                	jmp    80106691 <trap+0x1f6>
    ideintr();
    lapiceoi();
    break;
  case T_IRQ0 + IRQ_IDE+1:
    // Bochs generates spurious IDE1 interrupts.
    break;
80106690:	90                   	nop
  }

  // Force process exit if it has been killed and is in user space.
  // (If it is still executing in the kernel, let it keep running 
  // until it gets to the regular system call return.)
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
80106691:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106697:	85 c0                	test   %eax,%eax
80106699:	74 24                	je     801066bf <trap+0x224>
8010669b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801066a1:	8b 40 24             	mov    0x24(%eax),%eax
801066a4:	85 c0                	test   %eax,%eax
801066a6:	74 17                	je     801066bf <trap+0x224>
801066a8:	8b 45 08             	mov    0x8(%ebp),%eax
801066ab:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
801066af:	0f b7 c0             	movzwl %ax,%eax
801066b2:	83 e0 03             	and    $0x3,%eax
801066b5:	83 f8 03             	cmp    $0x3,%eax
801066b8:	75 05                	jne    801066bf <trap+0x224>
    exit();
801066ba:	e8 cf de ff ff       	call   8010458e <exit>

  // Force process to give up CPU on clock tick.
  // If interrupts were on while locks held, would need to check nlock.
  if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
801066bf:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801066c5:	85 c0                	test   %eax,%eax
801066c7:	74 1e                	je     801066e7 <trap+0x24c>
801066c9:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801066cf:	8b 40 0c             	mov    0xc(%eax),%eax
801066d2:	83 f8 04             	cmp    $0x4,%eax
801066d5:	75 10                	jne    801066e7 <trap+0x24c>
801066d7:	8b 45 08             	mov    0x8(%ebp),%eax
801066da:	8b 40 30             	mov    0x30(%eax),%eax
801066dd:	83 f8 20             	cmp    $0x20,%eax
801066e0:	75 05                	jne    801066e7 <trap+0x24c>
    yield();
801066e2:	e8 44 e2 ff ff       	call   8010492b <yield>

  // Check if the process has been killed since we yielded
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
801066e7:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801066ed:	85 c0                	test   %eax,%eax
801066ef:	74 27                	je     80106718 <trap+0x27d>
801066f1:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801066f7:	8b 40 24             	mov    0x24(%eax),%eax
801066fa:	85 c0                	test   %eax,%eax
801066fc:	74 1a                	je     80106718 <trap+0x27d>
801066fe:	8b 45 08             	mov    0x8(%ebp),%eax
80106701:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
80106705:	0f b7 c0             	movzwl %ax,%eax
80106708:	83 e0 03             	and    $0x3,%eax
8010670b:	83 f8 03             	cmp    $0x3,%eax
8010670e:	75 08                	jne    80106718 <trap+0x27d>
    exit();
80106710:	e8 79 de ff ff       	call   8010458e <exit>
80106715:	eb 01                	jmp    80106718 <trap+0x27d>
      exit();
    proc->tf = tf;
    syscall();
    if(proc->killed)
      exit();
    return;
80106717:	90                   	nop
    yield();

  // Check if the process has been killed since we yielded
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
    exit();
}
80106718:	83 c4 3c             	add    $0x3c,%esp
8010671b:	5b                   	pop    %ebx
8010671c:	5e                   	pop    %esi
8010671d:	5f                   	pop    %edi
8010671e:	5d                   	pop    %ebp
8010671f:	c3                   	ret    

80106720 <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
80106720:	55                   	push   %ebp
80106721:	89 e5                	mov    %esp,%ebp
80106723:	53                   	push   %ebx
80106724:	83 ec 14             	sub    $0x14,%esp
80106727:	8b 45 08             	mov    0x8(%ebp),%eax
8010672a:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010672e:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
80106732:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
80106736:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
8010673a:	ec                   	in     (%dx),%al
8010673b:	89 c3                	mov    %eax,%ebx
8010673d:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
80106740:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
80106744:	83 c4 14             	add    $0x14,%esp
80106747:	5b                   	pop    %ebx
80106748:	5d                   	pop    %ebp
80106749:	c3                   	ret    

8010674a <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
8010674a:	55                   	push   %ebp
8010674b:	89 e5                	mov    %esp,%ebp
8010674d:	83 ec 08             	sub    $0x8,%esp
80106750:	8b 55 08             	mov    0x8(%ebp),%edx
80106753:	8b 45 0c             	mov    0xc(%ebp),%eax
80106756:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
8010675a:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010675d:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80106761:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80106765:	ee                   	out    %al,(%dx)
}
80106766:	c9                   	leave  
80106767:	c3                   	ret    

80106768 <uartinit>:

static int uart;    // is there a uart?

void
uartinit(void)
{
80106768:	55                   	push   %ebp
80106769:	89 e5                	mov    %esp,%ebp
8010676b:	83 ec 28             	sub    $0x28,%esp
  char *p;

  // Turn off the FIFO
  outb(COM1+2, 0);
8010676e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80106775:	00 
80106776:	c7 04 24 fa 03 00 00 	movl   $0x3fa,(%esp)
8010677d:	e8 c8 ff ff ff       	call   8010674a <outb>
  
  // 9600 baud, 8 data bits, 1 stop bit, parity off.
  outb(COM1+3, 0x80);    // Unlock divisor
80106782:	c7 44 24 04 80 00 00 	movl   $0x80,0x4(%esp)
80106789:	00 
8010678a:	c7 04 24 fb 03 00 00 	movl   $0x3fb,(%esp)
80106791:	e8 b4 ff ff ff       	call   8010674a <outb>
  outb(COM1+0, 115200/9600);
80106796:	c7 44 24 04 0c 00 00 	movl   $0xc,0x4(%esp)
8010679d:	00 
8010679e:	c7 04 24 f8 03 00 00 	movl   $0x3f8,(%esp)
801067a5:	e8 a0 ff ff ff       	call   8010674a <outb>
  outb(COM1+1, 0);
801067aa:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801067b1:	00 
801067b2:	c7 04 24 f9 03 00 00 	movl   $0x3f9,(%esp)
801067b9:	e8 8c ff ff ff       	call   8010674a <outb>
  outb(COM1+3, 0x03);    // Lock divisor, 8 data bits.
801067be:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
801067c5:	00 
801067c6:	c7 04 24 fb 03 00 00 	movl   $0x3fb,(%esp)
801067cd:	e8 78 ff ff ff       	call   8010674a <outb>
  outb(COM1+4, 0);
801067d2:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801067d9:	00 
801067da:	c7 04 24 fc 03 00 00 	movl   $0x3fc,(%esp)
801067e1:	e8 64 ff ff ff       	call   8010674a <outb>
  outb(COM1+1, 0x01);    // Enable receive interrupts.
801067e6:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
801067ed:	00 
801067ee:	c7 04 24 f9 03 00 00 	movl   $0x3f9,(%esp)
801067f5:	e8 50 ff ff ff       	call   8010674a <outb>

  // If status is 0xFF, no serial port.
  if(inb(COM1+5) == 0xFF)
801067fa:	c7 04 24 fd 03 00 00 	movl   $0x3fd,(%esp)
80106801:	e8 1a ff ff ff       	call   80106720 <inb>
80106806:	3c ff                	cmp    $0xff,%al
80106808:	74 6c                	je     80106876 <uartinit+0x10e>
    return;
  uart = 1;
8010680a:	c7 05 4c c6 10 80 01 	movl   $0x1,0x8010c64c
80106811:	00 00 00 

  // Acknowledge pre-existing interrupt conditions;
  // enable interrupts.
  inb(COM1+2);
80106814:	c7 04 24 fa 03 00 00 	movl   $0x3fa,(%esp)
8010681b:	e8 00 ff ff ff       	call   80106720 <inb>
  inb(COM1+0);
80106820:	c7 04 24 f8 03 00 00 	movl   $0x3f8,(%esp)
80106827:	e8 f4 fe ff ff       	call   80106720 <inb>
  picenable(IRQ_COM1);
8010682c:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
80106833:	e8 c9 d3 ff ff       	call   80103c01 <picenable>
  ioapicenable(IRQ_COM1, 0);
80106838:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
8010683f:	00 
80106840:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
80106847:	e8 3a c1 ff ff       	call   80102986 <ioapicenable>
  
  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
8010684c:	c7 45 f4 08 8f 10 80 	movl   $0x80108f08,-0xc(%ebp)
80106853:	eb 15                	jmp    8010686a <uartinit+0x102>
    uartputc(*p);
80106855:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106858:	0f b6 00             	movzbl (%eax),%eax
8010685b:	0f be c0             	movsbl %al,%eax
8010685e:	89 04 24             	mov    %eax,(%esp)
80106861:	e8 13 00 00 00       	call   80106879 <uartputc>
  inb(COM1+0);
  picenable(IRQ_COM1);
  ioapicenable(IRQ_COM1, 0);
  
  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
80106866:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010686a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010686d:	0f b6 00             	movzbl (%eax),%eax
80106870:	84 c0                	test   %al,%al
80106872:	75 e1                	jne    80106855 <uartinit+0xed>
80106874:	eb 01                	jmp    80106877 <uartinit+0x10f>
  outb(COM1+4, 0);
  outb(COM1+1, 0x01);    // Enable receive interrupts.

  // If status is 0xFF, no serial port.
  if(inb(COM1+5) == 0xFF)
    return;
80106876:	90                   	nop
  ioapicenable(IRQ_COM1, 0);
  
  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
    uartputc(*p);
}
80106877:	c9                   	leave  
80106878:	c3                   	ret    

80106879 <uartputc>:

void
uartputc(int c)
{
80106879:	55                   	push   %ebp
8010687a:	89 e5                	mov    %esp,%ebp
8010687c:	83 ec 28             	sub    $0x28,%esp
  int i;

  if(!uart)
8010687f:	a1 4c c6 10 80       	mov    0x8010c64c,%eax
80106884:	85 c0                	test   %eax,%eax
80106886:	74 4d                	je     801068d5 <uartputc+0x5c>
    return;
  for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
80106888:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010688f:	eb 10                	jmp    801068a1 <uartputc+0x28>
    microdelay(10);
80106891:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
80106898:	e8 85 c7 ff ff       	call   80103022 <microdelay>
{
  int i;

  if(!uart)
    return;
  for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
8010689d:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801068a1:	83 7d f4 7f          	cmpl   $0x7f,-0xc(%ebp)
801068a5:	7f 16                	jg     801068bd <uartputc+0x44>
801068a7:	c7 04 24 fd 03 00 00 	movl   $0x3fd,(%esp)
801068ae:	e8 6d fe ff ff       	call   80106720 <inb>
801068b3:	0f b6 c0             	movzbl %al,%eax
801068b6:	83 e0 20             	and    $0x20,%eax
801068b9:	85 c0                	test   %eax,%eax
801068bb:	74 d4                	je     80106891 <uartputc+0x18>
    microdelay(10);
  outb(COM1+0, c);
801068bd:	8b 45 08             	mov    0x8(%ebp),%eax
801068c0:	0f b6 c0             	movzbl %al,%eax
801068c3:	89 44 24 04          	mov    %eax,0x4(%esp)
801068c7:	c7 04 24 f8 03 00 00 	movl   $0x3f8,(%esp)
801068ce:	e8 77 fe ff ff       	call   8010674a <outb>
801068d3:	eb 01                	jmp    801068d6 <uartputc+0x5d>
uartputc(int c)
{
  int i;

  if(!uart)
    return;
801068d5:	90                   	nop
  for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
    microdelay(10);
  outb(COM1+0, c);
}
801068d6:	c9                   	leave  
801068d7:	c3                   	ret    

801068d8 <uartgetc>:

static int
uartgetc(void)
{
801068d8:	55                   	push   %ebp
801068d9:	89 e5                	mov    %esp,%ebp
801068db:	83 ec 04             	sub    $0x4,%esp
  if(!uart)
801068de:	a1 4c c6 10 80       	mov    0x8010c64c,%eax
801068e3:	85 c0                	test   %eax,%eax
801068e5:	75 07                	jne    801068ee <uartgetc+0x16>
    return -1;
801068e7:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801068ec:	eb 2c                	jmp    8010691a <uartgetc+0x42>
  if(!(inb(COM1+5) & 0x01))
801068ee:	c7 04 24 fd 03 00 00 	movl   $0x3fd,(%esp)
801068f5:	e8 26 fe ff ff       	call   80106720 <inb>
801068fa:	0f b6 c0             	movzbl %al,%eax
801068fd:	83 e0 01             	and    $0x1,%eax
80106900:	85 c0                	test   %eax,%eax
80106902:	75 07                	jne    8010690b <uartgetc+0x33>
    return -1;
80106904:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106909:	eb 0f                	jmp    8010691a <uartgetc+0x42>
  return inb(COM1+0);
8010690b:	c7 04 24 f8 03 00 00 	movl   $0x3f8,(%esp)
80106912:	e8 09 fe ff ff       	call   80106720 <inb>
80106917:	0f b6 c0             	movzbl %al,%eax
}
8010691a:	c9                   	leave  
8010691b:	c3                   	ret    

8010691c <uartintr>:

void
uartintr(void)
{
8010691c:	55                   	push   %ebp
8010691d:	89 e5                	mov    %esp,%ebp
8010691f:	83 ec 18             	sub    $0x18,%esp
  consoleintr(uartgetc);
80106922:	c7 04 24 d8 68 10 80 	movl   $0x801068d8,(%esp)
80106929:	e8 97 9e ff ff       	call   801007c5 <consoleintr>
}
8010692e:	c9                   	leave  
8010692f:	c3                   	ret    

80106930 <vector0>:
# generated by vectors.pl - do not edit
# handlers
.globl alltraps
.globl vector0
vector0:
  pushl $0
80106930:	6a 00                	push   $0x0
  pushl $0
80106932:	6a 00                	push   $0x0
  jmp alltraps
80106934:	e9 67 f9 ff ff       	jmp    801062a0 <alltraps>

80106939 <vector1>:
.globl vector1
vector1:
  pushl $0
80106939:	6a 00                	push   $0x0
  pushl $1
8010693b:	6a 01                	push   $0x1
  jmp alltraps
8010693d:	e9 5e f9 ff ff       	jmp    801062a0 <alltraps>

80106942 <vector2>:
.globl vector2
vector2:
  pushl $0
80106942:	6a 00                	push   $0x0
  pushl $2
80106944:	6a 02                	push   $0x2
  jmp alltraps
80106946:	e9 55 f9 ff ff       	jmp    801062a0 <alltraps>

8010694b <vector3>:
.globl vector3
vector3:
  pushl $0
8010694b:	6a 00                	push   $0x0
  pushl $3
8010694d:	6a 03                	push   $0x3
  jmp alltraps
8010694f:	e9 4c f9 ff ff       	jmp    801062a0 <alltraps>

80106954 <vector4>:
.globl vector4
vector4:
  pushl $0
80106954:	6a 00                	push   $0x0
  pushl $4
80106956:	6a 04                	push   $0x4
  jmp alltraps
80106958:	e9 43 f9 ff ff       	jmp    801062a0 <alltraps>

8010695d <vector5>:
.globl vector5
vector5:
  pushl $0
8010695d:	6a 00                	push   $0x0
  pushl $5
8010695f:	6a 05                	push   $0x5
  jmp alltraps
80106961:	e9 3a f9 ff ff       	jmp    801062a0 <alltraps>

80106966 <vector6>:
.globl vector6
vector6:
  pushl $0
80106966:	6a 00                	push   $0x0
  pushl $6
80106968:	6a 06                	push   $0x6
  jmp alltraps
8010696a:	e9 31 f9 ff ff       	jmp    801062a0 <alltraps>

8010696f <vector7>:
.globl vector7
vector7:
  pushl $0
8010696f:	6a 00                	push   $0x0
  pushl $7
80106971:	6a 07                	push   $0x7
  jmp alltraps
80106973:	e9 28 f9 ff ff       	jmp    801062a0 <alltraps>

80106978 <vector8>:
.globl vector8
vector8:
  pushl $8
80106978:	6a 08                	push   $0x8
  jmp alltraps
8010697a:	e9 21 f9 ff ff       	jmp    801062a0 <alltraps>

8010697f <vector9>:
.globl vector9
vector9:
  pushl $0
8010697f:	6a 00                	push   $0x0
  pushl $9
80106981:	6a 09                	push   $0x9
  jmp alltraps
80106983:	e9 18 f9 ff ff       	jmp    801062a0 <alltraps>

80106988 <vector10>:
.globl vector10
vector10:
  pushl $10
80106988:	6a 0a                	push   $0xa
  jmp alltraps
8010698a:	e9 11 f9 ff ff       	jmp    801062a0 <alltraps>

8010698f <vector11>:
.globl vector11
vector11:
  pushl $11
8010698f:	6a 0b                	push   $0xb
  jmp alltraps
80106991:	e9 0a f9 ff ff       	jmp    801062a0 <alltraps>

80106996 <vector12>:
.globl vector12
vector12:
  pushl $12
80106996:	6a 0c                	push   $0xc
  jmp alltraps
80106998:	e9 03 f9 ff ff       	jmp    801062a0 <alltraps>

8010699d <vector13>:
.globl vector13
vector13:
  pushl $13
8010699d:	6a 0d                	push   $0xd
  jmp alltraps
8010699f:	e9 fc f8 ff ff       	jmp    801062a0 <alltraps>

801069a4 <vector14>:
.globl vector14
vector14:
  pushl $14
801069a4:	6a 0e                	push   $0xe
  jmp alltraps
801069a6:	e9 f5 f8 ff ff       	jmp    801062a0 <alltraps>

801069ab <vector15>:
.globl vector15
vector15:
  pushl $0
801069ab:	6a 00                	push   $0x0
  pushl $15
801069ad:	6a 0f                	push   $0xf
  jmp alltraps
801069af:	e9 ec f8 ff ff       	jmp    801062a0 <alltraps>

801069b4 <vector16>:
.globl vector16
vector16:
  pushl $0
801069b4:	6a 00                	push   $0x0
  pushl $16
801069b6:	6a 10                	push   $0x10
  jmp alltraps
801069b8:	e9 e3 f8 ff ff       	jmp    801062a0 <alltraps>

801069bd <vector17>:
.globl vector17
vector17:
  pushl $17
801069bd:	6a 11                	push   $0x11
  jmp alltraps
801069bf:	e9 dc f8 ff ff       	jmp    801062a0 <alltraps>

801069c4 <vector18>:
.globl vector18
vector18:
  pushl $0
801069c4:	6a 00                	push   $0x0
  pushl $18
801069c6:	6a 12                	push   $0x12
  jmp alltraps
801069c8:	e9 d3 f8 ff ff       	jmp    801062a0 <alltraps>

801069cd <vector19>:
.globl vector19
vector19:
  pushl $0
801069cd:	6a 00                	push   $0x0
  pushl $19
801069cf:	6a 13                	push   $0x13
  jmp alltraps
801069d1:	e9 ca f8 ff ff       	jmp    801062a0 <alltraps>

801069d6 <vector20>:
.globl vector20
vector20:
  pushl $0
801069d6:	6a 00                	push   $0x0
  pushl $20
801069d8:	6a 14                	push   $0x14
  jmp alltraps
801069da:	e9 c1 f8 ff ff       	jmp    801062a0 <alltraps>

801069df <vector21>:
.globl vector21
vector21:
  pushl $0
801069df:	6a 00                	push   $0x0
  pushl $21
801069e1:	6a 15                	push   $0x15
  jmp alltraps
801069e3:	e9 b8 f8 ff ff       	jmp    801062a0 <alltraps>

801069e8 <vector22>:
.globl vector22
vector22:
  pushl $0
801069e8:	6a 00                	push   $0x0
  pushl $22
801069ea:	6a 16                	push   $0x16
  jmp alltraps
801069ec:	e9 af f8 ff ff       	jmp    801062a0 <alltraps>

801069f1 <vector23>:
.globl vector23
vector23:
  pushl $0
801069f1:	6a 00                	push   $0x0
  pushl $23
801069f3:	6a 17                	push   $0x17
  jmp alltraps
801069f5:	e9 a6 f8 ff ff       	jmp    801062a0 <alltraps>

801069fa <vector24>:
.globl vector24
vector24:
  pushl $0
801069fa:	6a 00                	push   $0x0
  pushl $24
801069fc:	6a 18                	push   $0x18
  jmp alltraps
801069fe:	e9 9d f8 ff ff       	jmp    801062a0 <alltraps>

80106a03 <vector25>:
.globl vector25
vector25:
  pushl $0
80106a03:	6a 00                	push   $0x0
  pushl $25
80106a05:	6a 19                	push   $0x19
  jmp alltraps
80106a07:	e9 94 f8 ff ff       	jmp    801062a0 <alltraps>

80106a0c <vector26>:
.globl vector26
vector26:
  pushl $0
80106a0c:	6a 00                	push   $0x0
  pushl $26
80106a0e:	6a 1a                	push   $0x1a
  jmp alltraps
80106a10:	e9 8b f8 ff ff       	jmp    801062a0 <alltraps>

80106a15 <vector27>:
.globl vector27
vector27:
  pushl $0
80106a15:	6a 00                	push   $0x0
  pushl $27
80106a17:	6a 1b                	push   $0x1b
  jmp alltraps
80106a19:	e9 82 f8 ff ff       	jmp    801062a0 <alltraps>

80106a1e <vector28>:
.globl vector28
vector28:
  pushl $0
80106a1e:	6a 00                	push   $0x0
  pushl $28
80106a20:	6a 1c                	push   $0x1c
  jmp alltraps
80106a22:	e9 79 f8 ff ff       	jmp    801062a0 <alltraps>

80106a27 <vector29>:
.globl vector29
vector29:
  pushl $0
80106a27:	6a 00                	push   $0x0
  pushl $29
80106a29:	6a 1d                	push   $0x1d
  jmp alltraps
80106a2b:	e9 70 f8 ff ff       	jmp    801062a0 <alltraps>

80106a30 <vector30>:
.globl vector30
vector30:
  pushl $0
80106a30:	6a 00                	push   $0x0
  pushl $30
80106a32:	6a 1e                	push   $0x1e
  jmp alltraps
80106a34:	e9 67 f8 ff ff       	jmp    801062a0 <alltraps>

80106a39 <vector31>:
.globl vector31
vector31:
  pushl $0
80106a39:	6a 00                	push   $0x0
  pushl $31
80106a3b:	6a 1f                	push   $0x1f
  jmp alltraps
80106a3d:	e9 5e f8 ff ff       	jmp    801062a0 <alltraps>

80106a42 <vector32>:
.globl vector32
vector32:
  pushl $0
80106a42:	6a 00                	push   $0x0
  pushl $32
80106a44:	6a 20                	push   $0x20
  jmp alltraps
80106a46:	e9 55 f8 ff ff       	jmp    801062a0 <alltraps>

80106a4b <vector33>:
.globl vector33
vector33:
  pushl $0
80106a4b:	6a 00                	push   $0x0
  pushl $33
80106a4d:	6a 21                	push   $0x21
  jmp alltraps
80106a4f:	e9 4c f8 ff ff       	jmp    801062a0 <alltraps>

80106a54 <vector34>:
.globl vector34
vector34:
  pushl $0
80106a54:	6a 00                	push   $0x0
  pushl $34
80106a56:	6a 22                	push   $0x22
  jmp alltraps
80106a58:	e9 43 f8 ff ff       	jmp    801062a0 <alltraps>

80106a5d <vector35>:
.globl vector35
vector35:
  pushl $0
80106a5d:	6a 00                	push   $0x0
  pushl $35
80106a5f:	6a 23                	push   $0x23
  jmp alltraps
80106a61:	e9 3a f8 ff ff       	jmp    801062a0 <alltraps>

80106a66 <vector36>:
.globl vector36
vector36:
  pushl $0
80106a66:	6a 00                	push   $0x0
  pushl $36
80106a68:	6a 24                	push   $0x24
  jmp alltraps
80106a6a:	e9 31 f8 ff ff       	jmp    801062a0 <alltraps>

80106a6f <vector37>:
.globl vector37
vector37:
  pushl $0
80106a6f:	6a 00                	push   $0x0
  pushl $37
80106a71:	6a 25                	push   $0x25
  jmp alltraps
80106a73:	e9 28 f8 ff ff       	jmp    801062a0 <alltraps>

80106a78 <vector38>:
.globl vector38
vector38:
  pushl $0
80106a78:	6a 00                	push   $0x0
  pushl $38
80106a7a:	6a 26                	push   $0x26
  jmp alltraps
80106a7c:	e9 1f f8 ff ff       	jmp    801062a0 <alltraps>

80106a81 <vector39>:
.globl vector39
vector39:
  pushl $0
80106a81:	6a 00                	push   $0x0
  pushl $39
80106a83:	6a 27                	push   $0x27
  jmp alltraps
80106a85:	e9 16 f8 ff ff       	jmp    801062a0 <alltraps>

80106a8a <vector40>:
.globl vector40
vector40:
  pushl $0
80106a8a:	6a 00                	push   $0x0
  pushl $40
80106a8c:	6a 28                	push   $0x28
  jmp alltraps
80106a8e:	e9 0d f8 ff ff       	jmp    801062a0 <alltraps>

80106a93 <vector41>:
.globl vector41
vector41:
  pushl $0
80106a93:	6a 00                	push   $0x0
  pushl $41
80106a95:	6a 29                	push   $0x29
  jmp alltraps
80106a97:	e9 04 f8 ff ff       	jmp    801062a0 <alltraps>

80106a9c <vector42>:
.globl vector42
vector42:
  pushl $0
80106a9c:	6a 00                	push   $0x0
  pushl $42
80106a9e:	6a 2a                	push   $0x2a
  jmp alltraps
80106aa0:	e9 fb f7 ff ff       	jmp    801062a0 <alltraps>

80106aa5 <vector43>:
.globl vector43
vector43:
  pushl $0
80106aa5:	6a 00                	push   $0x0
  pushl $43
80106aa7:	6a 2b                	push   $0x2b
  jmp alltraps
80106aa9:	e9 f2 f7 ff ff       	jmp    801062a0 <alltraps>

80106aae <vector44>:
.globl vector44
vector44:
  pushl $0
80106aae:	6a 00                	push   $0x0
  pushl $44
80106ab0:	6a 2c                	push   $0x2c
  jmp alltraps
80106ab2:	e9 e9 f7 ff ff       	jmp    801062a0 <alltraps>

80106ab7 <vector45>:
.globl vector45
vector45:
  pushl $0
80106ab7:	6a 00                	push   $0x0
  pushl $45
80106ab9:	6a 2d                	push   $0x2d
  jmp alltraps
80106abb:	e9 e0 f7 ff ff       	jmp    801062a0 <alltraps>

80106ac0 <vector46>:
.globl vector46
vector46:
  pushl $0
80106ac0:	6a 00                	push   $0x0
  pushl $46
80106ac2:	6a 2e                	push   $0x2e
  jmp alltraps
80106ac4:	e9 d7 f7 ff ff       	jmp    801062a0 <alltraps>

80106ac9 <vector47>:
.globl vector47
vector47:
  pushl $0
80106ac9:	6a 00                	push   $0x0
  pushl $47
80106acb:	6a 2f                	push   $0x2f
  jmp alltraps
80106acd:	e9 ce f7 ff ff       	jmp    801062a0 <alltraps>

80106ad2 <vector48>:
.globl vector48
vector48:
  pushl $0
80106ad2:	6a 00                	push   $0x0
  pushl $48
80106ad4:	6a 30                	push   $0x30
  jmp alltraps
80106ad6:	e9 c5 f7 ff ff       	jmp    801062a0 <alltraps>

80106adb <vector49>:
.globl vector49
vector49:
  pushl $0
80106adb:	6a 00                	push   $0x0
  pushl $49
80106add:	6a 31                	push   $0x31
  jmp alltraps
80106adf:	e9 bc f7 ff ff       	jmp    801062a0 <alltraps>

80106ae4 <vector50>:
.globl vector50
vector50:
  pushl $0
80106ae4:	6a 00                	push   $0x0
  pushl $50
80106ae6:	6a 32                	push   $0x32
  jmp alltraps
80106ae8:	e9 b3 f7 ff ff       	jmp    801062a0 <alltraps>

80106aed <vector51>:
.globl vector51
vector51:
  pushl $0
80106aed:	6a 00                	push   $0x0
  pushl $51
80106aef:	6a 33                	push   $0x33
  jmp alltraps
80106af1:	e9 aa f7 ff ff       	jmp    801062a0 <alltraps>

80106af6 <vector52>:
.globl vector52
vector52:
  pushl $0
80106af6:	6a 00                	push   $0x0
  pushl $52
80106af8:	6a 34                	push   $0x34
  jmp alltraps
80106afa:	e9 a1 f7 ff ff       	jmp    801062a0 <alltraps>

80106aff <vector53>:
.globl vector53
vector53:
  pushl $0
80106aff:	6a 00                	push   $0x0
  pushl $53
80106b01:	6a 35                	push   $0x35
  jmp alltraps
80106b03:	e9 98 f7 ff ff       	jmp    801062a0 <alltraps>

80106b08 <vector54>:
.globl vector54
vector54:
  pushl $0
80106b08:	6a 00                	push   $0x0
  pushl $54
80106b0a:	6a 36                	push   $0x36
  jmp alltraps
80106b0c:	e9 8f f7 ff ff       	jmp    801062a0 <alltraps>

80106b11 <vector55>:
.globl vector55
vector55:
  pushl $0
80106b11:	6a 00                	push   $0x0
  pushl $55
80106b13:	6a 37                	push   $0x37
  jmp alltraps
80106b15:	e9 86 f7 ff ff       	jmp    801062a0 <alltraps>

80106b1a <vector56>:
.globl vector56
vector56:
  pushl $0
80106b1a:	6a 00                	push   $0x0
  pushl $56
80106b1c:	6a 38                	push   $0x38
  jmp alltraps
80106b1e:	e9 7d f7 ff ff       	jmp    801062a0 <alltraps>

80106b23 <vector57>:
.globl vector57
vector57:
  pushl $0
80106b23:	6a 00                	push   $0x0
  pushl $57
80106b25:	6a 39                	push   $0x39
  jmp alltraps
80106b27:	e9 74 f7 ff ff       	jmp    801062a0 <alltraps>

80106b2c <vector58>:
.globl vector58
vector58:
  pushl $0
80106b2c:	6a 00                	push   $0x0
  pushl $58
80106b2e:	6a 3a                	push   $0x3a
  jmp alltraps
80106b30:	e9 6b f7 ff ff       	jmp    801062a0 <alltraps>

80106b35 <vector59>:
.globl vector59
vector59:
  pushl $0
80106b35:	6a 00                	push   $0x0
  pushl $59
80106b37:	6a 3b                	push   $0x3b
  jmp alltraps
80106b39:	e9 62 f7 ff ff       	jmp    801062a0 <alltraps>

80106b3e <vector60>:
.globl vector60
vector60:
  pushl $0
80106b3e:	6a 00                	push   $0x0
  pushl $60
80106b40:	6a 3c                	push   $0x3c
  jmp alltraps
80106b42:	e9 59 f7 ff ff       	jmp    801062a0 <alltraps>

80106b47 <vector61>:
.globl vector61
vector61:
  pushl $0
80106b47:	6a 00                	push   $0x0
  pushl $61
80106b49:	6a 3d                	push   $0x3d
  jmp alltraps
80106b4b:	e9 50 f7 ff ff       	jmp    801062a0 <alltraps>

80106b50 <vector62>:
.globl vector62
vector62:
  pushl $0
80106b50:	6a 00                	push   $0x0
  pushl $62
80106b52:	6a 3e                	push   $0x3e
  jmp alltraps
80106b54:	e9 47 f7 ff ff       	jmp    801062a0 <alltraps>

80106b59 <vector63>:
.globl vector63
vector63:
  pushl $0
80106b59:	6a 00                	push   $0x0
  pushl $63
80106b5b:	6a 3f                	push   $0x3f
  jmp alltraps
80106b5d:	e9 3e f7 ff ff       	jmp    801062a0 <alltraps>

80106b62 <vector64>:
.globl vector64
vector64:
  pushl $0
80106b62:	6a 00                	push   $0x0
  pushl $64
80106b64:	6a 40                	push   $0x40
  jmp alltraps
80106b66:	e9 35 f7 ff ff       	jmp    801062a0 <alltraps>

80106b6b <vector65>:
.globl vector65
vector65:
  pushl $0
80106b6b:	6a 00                	push   $0x0
  pushl $65
80106b6d:	6a 41                	push   $0x41
  jmp alltraps
80106b6f:	e9 2c f7 ff ff       	jmp    801062a0 <alltraps>

80106b74 <vector66>:
.globl vector66
vector66:
  pushl $0
80106b74:	6a 00                	push   $0x0
  pushl $66
80106b76:	6a 42                	push   $0x42
  jmp alltraps
80106b78:	e9 23 f7 ff ff       	jmp    801062a0 <alltraps>

80106b7d <vector67>:
.globl vector67
vector67:
  pushl $0
80106b7d:	6a 00                	push   $0x0
  pushl $67
80106b7f:	6a 43                	push   $0x43
  jmp alltraps
80106b81:	e9 1a f7 ff ff       	jmp    801062a0 <alltraps>

80106b86 <vector68>:
.globl vector68
vector68:
  pushl $0
80106b86:	6a 00                	push   $0x0
  pushl $68
80106b88:	6a 44                	push   $0x44
  jmp alltraps
80106b8a:	e9 11 f7 ff ff       	jmp    801062a0 <alltraps>

80106b8f <vector69>:
.globl vector69
vector69:
  pushl $0
80106b8f:	6a 00                	push   $0x0
  pushl $69
80106b91:	6a 45                	push   $0x45
  jmp alltraps
80106b93:	e9 08 f7 ff ff       	jmp    801062a0 <alltraps>

80106b98 <vector70>:
.globl vector70
vector70:
  pushl $0
80106b98:	6a 00                	push   $0x0
  pushl $70
80106b9a:	6a 46                	push   $0x46
  jmp alltraps
80106b9c:	e9 ff f6 ff ff       	jmp    801062a0 <alltraps>

80106ba1 <vector71>:
.globl vector71
vector71:
  pushl $0
80106ba1:	6a 00                	push   $0x0
  pushl $71
80106ba3:	6a 47                	push   $0x47
  jmp alltraps
80106ba5:	e9 f6 f6 ff ff       	jmp    801062a0 <alltraps>

80106baa <vector72>:
.globl vector72
vector72:
  pushl $0
80106baa:	6a 00                	push   $0x0
  pushl $72
80106bac:	6a 48                	push   $0x48
  jmp alltraps
80106bae:	e9 ed f6 ff ff       	jmp    801062a0 <alltraps>

80106bb3 <vector73>:
.globl vector73
vector73:
  pushl $0
80106bb3:	6a 00                	push   $0x0
  pushl $73
80106bb5:	6a 49                	push   $0x49
  jmp alltraps
80106bb7:	e9 e4 f6 ff ff       	jmp    801062a0 <alltraps>

80106bbc <vector74>:
.globl vector74
vector74:
  pushl $0
80106bbc:	6a 00                	push   $0x0
  pushl $74
80106bbe:	6a 4a                	push   $0x4a
  jmp alltraps
80106bc0:	e9 db f6 ff ff       	jmp    801062a0 <alltraps>

80106bc5 <vector75>:
.globl vector75
vector75:
  pushl $0
80106bc5:	6a 00                	push   $0x0
  pushl $75
80106bc7:	6a 4b                	push   $0x4b
  jmp alltraps
80106bc9:	e9 d2 f6 ff ff       	jmp    801062a0 <alltraps>

80106bce <vector76>:
.globl vector76
vector76:
  pushl $0
80106bce:	6a 00                	push   $0x0
  pushl $76
80106bd0:	6a 4c                	push   $0x4c
  jmp alltraps
80106bd2:	e9 c9 f6 ff ff       	jmp    801062a0 <alltraps>

80106bd7 <vector77>:
.globl vector77
vector77:
  pushl $0
80106bd7:	6a 00                	push   $0x0
  pushl $77
80106bd9:	6a 4d                	push   $0x4d
  jmp alltraps
80106bdb:	e9 c0 f6 ff ff       	jmp    801062a0 <alltraps>

80106be0 <vector78>:
.globl vector78
vector78:
  pushl $0
80106be0:	6a 00                	push   $0x0
  pushl $78
80106be2:	6a 4e                	push   $0x4e
  jmp alltraps
80106be4:	e9 b7 f6 ff ff       	jmp    801062a0 <alltraps>

80106be9 <vector79>:
.globl vector79
vector79:
  pushl $0
80106be9:	6a 00                	push   $0x0
  pushl $79
80106beb:	6a 4f                	push   $0x4f
  jmp alltraps
80106bed:	e9 ae f6 ff ff       	jmp    801062a0 <alltraps>

80106bf2 <vector80>:
.globl vector80
vector80:
  pushl $0
80106bf2:	6a 00                	push   $0x0
  pushl $80
80106bf4:	6a 50                	push   $0x50
  jmp alltraps
80106bf6:	e9 a5 f6 ff ff       	jmp    801062a0 <alltraps>

80106bfb <vector81>:
.globl vector81
vector81:
  pushl $0
80106bfb:	6a 00                	push   $0x0
  pushl $81
80106bfd:	6a 51                	push   $0x51
  jmp alltraps
80106bff:	e9 9c f6 ff ff       	jmp    801062a0 <alltraps>

80106c04 <vector82>:
.globl vector82
vector82:
  pushl $0
80106c04:	6a 00                	push   $0x0
  pushl $82
80106c06:	6a 52                	push   $0x52
  jmp alltraps
80106c08:	e9 93 f6 ff ff       	jmp    801062a0 <alltraps>

80106c0d <vector83>:
.globl vector83
vector83:
  pushl $0
80106c0d:	6a 00                	push   $0x0
  pushl $83
80106c0f:	6a 53                	push   $0x53
  jmp alltraps
80106c11:	e9 8a f6 ff ff       	jmp    801062a0 <alltraps>

80106c16 <vector84>:
.globl vector84
vector84:
  pushl $0
80106c16:	6a 00                	push   $0x0
  pushl $84
80106c18:	6a 54                	push   $0x54
  jmp alltraps
80106c1a:	e9 81 f6 ff ff       	jmp    801062a0 <alltraps>

80106c1f <vector85>:
.globl vector85
vector85:
  pushl $0
80106c1f:	6a 00                	push   $0x0
  pushl $85
80106c21:	6a 55                	push   $0x55
  jmp alltraps
80106c23:	e9 78 f6 ff ff       	jmp    801062a0 <alltraps>

80106c28 <vector86>:
.globl vector86
vector86:
  pushl $0
80106c28:	6a 00                	push   $0x0
  pushl $86
80106c2a:	6a 56                	push   $0x56
  jmp alltraps
80106c2c:	e9 6f f6 ff ff       	jmp    801062a0 <alltraps>

80106c31 <vector87>:
.globl vector87
vector87:
  pushl $0
80106c31:	6a 00                	push   $0x0
  pushl $87
80106c33:	6a 57                	push   $0x57
  jmp alltraps
80106c35:	e9 66 f6 ff ff       	jmp    801062a0 <alltraps>

80106c3a <vector88>:
.globl vector88
vector88:
  pushl $0
80106c3a:	6a 00                	push   $0x0
  pushl $88
80106c3c:	6a 58                	push   $0x58
  jmp alltraps
80106c3e:	e9 5d f6 ff ff       	jmp    801062a0 <alltraps>

80106c43 <vector89>:
.globl vector89
vector89:
  pushl $0
80106c43:	6a 00                	push   $0x0
  pushl $89
80106c45:	6a 59                	push   $0x59
  jmp alltraps
80106c47:	e9 54 f6 ff ff       	jmp    801062a0 <alltraps>

80106c4c <vector90>:
.globl vector90
vector90:
  pushl $0
80106c4c:	6a 00                	push   $0x0
  pushl $90
80106c4e:	6a 5a                	push   $0x5a
  jmp alltraps
80106c50:	e9 4b f6 ff ff       	jmp    801062a0 <alltraps>

80106c55 <vector91>:
.globl vector91
vector91:
  pushl $0
80106c55:	6a 00                	push   $0x0
  pushl $91
80106c57:	6a 5b                	push   $0x5b
  jmp alltraps
80106c59:	e9 42 f6 ff ff       	jmp    801062a0 <alltraps>

80106c5e <vector92>:
.globl vector92
vector92:
  pushl $0
80106c5e:	6a 00                	push   $0x0
  pushl $92
80106c60:	6a 5c                	push   $0x5c
  jmp alltraps
80106c62:	e9 39 f6 ff ff       	jmp    801062a0 <alltraps>

80106c67 <vector93>:
.globl vector93
vector93:
  pushl $0
80106c67:	6a 00                	push   $0x0
  pushl $93
80106c69:	6a 5d                	push   $0x5d
  jmp alltraps
80106c6b:	e9 30 f6 ff ff       	jmp    801062a0 <alltraps>

80106c70 <vector94>:
.globl vector94
vector94:
  pushl $0
80106c70:	6a 00                	push   $0x0
  pushl $94
80106c72:	6a 5e                	push   $0x5e
  jmp alltraps
80106c74:	e9 27 f6 ff ff       	jmp    801062a0 <alltraps>

80106c79 <vector95>:
.globl vector95
vector95:
  pushl $0
80106c79:	6a 00                	push   $0x0
  pushl $95
80106c7b:	6a 5f                	push   $0x5f
  jmp alltraps
80106c7d:	e9 1e f6 ff ff       	jmp    801062a0 <alltraps>

80106c82 <vector96>:
.globl vector96
vector96:
  pushl $0
80106c82:	6a 00                	push   $0x0
  pushl $96
80106c84:	6a 60                	push   $0x60
  jmp alltraps
80106c86:	e9 15 f6 ff ff       	jmp    801062a0 <alltraps>

80106c8b <vector97>:
.globl vector97
vector97:
  pushl $0
80106c8b:	6a 00                	push   $0x0
  pushl $97
80106c8d:	6a 61                	push   $0x61
  jmp alltraps
80106c8f:	e9 0c f6 ff ff       	jmp    801062a0 <alltraps>

80106c94 <vector98>:
.globl vector98
vector98:
  pushl $0
80106c94:	6a 00                	push   $0x0
  pushl $98
80106c96:	6a 62                	push   $0x62
  jmp alltraps
80106c98:	e9 03 f6 ff ff       	jmp    801062a0 <alltraps>

80106c9d <vector99>:
.globl vector99
vector99:
  pushl $0
80106c9d:	6a 00                	push   $0x0
  pushl $99
80106c9f:	6a 63                	push   $0x63
  jmp alltraps
80106ca1:	e9 fa f5 ff ff       	jmp    801062a0 <alltraps>

80106ca6 <vector100>:
.globl vector100
vector100:
  pushl $0
80106ca6:	6a 00                	push   $0x0
  pushl $100
80106ca8:	6a 64                	push   $0x64
  jmp alltraps
80106caa:	e9 f1 f5 ff ff       	jmp    801062a0 <alltraps>

80106caf <vector101>:
.globl vector101
vector101:
  pushl $0
80106caf:	6a 00                	push   $0x0
  pushl $101
80106cb1:	6a 65                	push   $0x65
  jmp alltraps
80106cb3:	e9 e8 f5 ff ff       	jmp    801062a0 <alltraps>

80106cb8 <vector102>:
.globl vector102
vector102:
  pushl $0
80106cb8:	6a 00                	push   $0x0
  pushl $102
80106cba:	6a 66                	push   $0x66
  jmp alltraps
80106cbc:	e9 df f5 ff ff       	jmp    801062a0 <alltraps>

80106cc1 <vector103>:
.globl vector103
vector103:
  pushl $0
80106cc1:	6a 00                	push   $0x0
  pushl $103
80106cc3:	6a 67                	push   $0x67
  jmp alltraps
80106cc5:	e9 d6 f5 ff ff       	jmp    801062a0 <alltraps>

80106cca <vector104>:
.globl vector104
vector104:
  pushl $0
80106cca:	6a 00                	push   $0x0
  pushl $104
80106ccc:	6a 68                	push   $0x68
  jmp alltraps
80106cce:	e9 cd f5 ff ff       	jmp    801062a0 <alltraps>

80106cd3 <vector105>:
.globl vector105
vector105:
  pushl $0
80106cd3:	6a 00                	push   $0x0
  pushl $105
80106cd5:	6a 69                	push   $0x69
  jmp alltraps
80106cd7:	e9 c4 f5 ff ff       	jmp    801062a0 <alltraps>

80106cdc <vector106>:
.globl vector106
vector106:
  pushl $0
80106cdc:	6a 00                	push   $0x0
  pushl $106
80106cde:	6a 6a                	push   $0x6a
  jmp alltraps
80106ce0:	e9 bb f5 ff ff       	jmp    801062a0 <alltraps>

80106ce5 <vector107>:
.globl vector107
vector107:
  pushl $0
80106ce5:	6a 00                	push   $0x0
  pushl $107
80106ce7:	6a 6b                	push   $0x6b
  jmp alltraps
80106ce9:	e9 b2 f5 ff ff       	jmp    801062a0 <alltraps>

80106cee <vector108>:
.globl vector108
vector108:
  pushl $0
80106cee:	6a 00                	push   $0x0
  pushl $108
80106cf0:	6a 6c                	push   $0x6c
  jmp alltraps
80106cf2:	e9 a9 f5 ff ff       	jmp    801062a0 <alltraps>

80106cf7 <vector109>:
.globl vector109
vector109:
  pushl $0
80106cf7:	6a 00                	push   $0x0
  pushl $109
80106cf9:	6a 6d                	push   $0x6d
  jmp alltraps
80106cfb:	e9 a0 f5 ff ff       	jmp    801062a0 <alltraps>

80106d00 <vector110>:
.globl vector110
vector110:
  pushl $0
80106d00:	6a 00                	push   $0x0
  pushl $110
80106d02:	6a 6e                	push   $0x6e
  jmp alltraps
80106d04:	e9 97 f5 ff ff       	jmp    801062a0 <alltraps>

80106d09 <vector111>:
.globl vector111
vector111:
  pushl $0
80106d09:	6a 00                	push   $0x0
  pushl $111
80106d0b:	6a 6f                	push   $0x6f
  jmp alltraps
80106d0d:	e9 8e f5 ff ff       	jmp    801062a0 <alltraps>

80106d12 <vector112>:
.globl vector112
vector112:
  pushl $0
80106d12:	6a 00                	push   $0x0
  pushl $112
80106d14:	6a 70                	push   $0x70
  jmp alltraps
80106d16:	e9 85 f5 ff ff       	jmp    801062a0 <alltraps>

80106d1b <vector113>:
.globl vector113
vector113:
  pushl $0
80106d1b:	6a 00                	push   $0x0
  pushl $113
80106d1d:	6a 71                	push   $0x71
  jmp alltraps
80106d1f:	e9 7c f5 ff ff       	jmp    801062a0 <alltraps>

80106d24 <vector114>:
.globl vector114
vector114:
  pushl $0
80106d24:	6a 00                	push   $0x0
  pushl $114
80106d26:	6a 72                	push   $0x72
  jmp alltraps
80106d28:	e9 73 f5 ff ff       	jmp    801062a0 <alltraps>

80106d2d <vector115>:
.globl vector115
vector115:
  pushl $0
80106d2d:	6a 00                	push   $0x0
  pushl $115
80106d2f:	6a 73                	push   $0x73
  jmp alltraps
80106d31:	e9 6a f5 ff ff       	jmp    801062a0 <alltraps>

80106d36 <vector116>:
.globl vector116
vector116:
  pushl $0
80106d36:	6a 00                	push   $0x0
  pushl $116
80106d38:	6a 74                	push   $0x74
  jmp alltraps
80106d3a:	e9 61 f5 ff ff       	jmp    801062a0 <alltraps>

80106d3f <vector117>:
.globl vector117
vector117:
  pushl $0
80106d3f:	6a 00                	push   $0x0
  pushl $117
80106d41:	6a 75                	push   $0x75
  jmp alltraps
80106d43:	e9 58 f5 ff ff       	jmp    801062a0 <alltraps>

80106d48 <vector118>:
.globl vector118
vector118:
  pushl $0
80106d48:	6a 00                	push   $0x0
  pushl $118
80106d4a:	6a 76                	push   $0x76
  jmp alltraps
80106d4c:	e9 4f f5 ff ff       	jmp    801062a0 <alltraps>

80106d51 <vector119>:
.globl vector119
vector119:
  pushl $0
80106d51:	6a 00                	push   $0x0
  pushl $119
80106d53:	6a 77                	push   $0x77
  jmp alltraps
80106d55:	e9 46 f5 ff ff       	jmp    801062a0 <alltraps>

80106d5a <vector120>:
.globl vector120
vector120:
  pushl $0
80106d5a:	6a 00                	push   $0x0
  pushl $120
80106d5c:	6a 78                	push   $0x78
  jmp alltraps
80106d5e:	e9 3d f5 ff ff       	jmp    801062a0 <alltraps>

80106d63 <vector121>:
.globl vector121
vector121:
  pushl $0
80106d63:	6a 00                	push   $0x0
  pushl $121
80106d65:	6a 79                	push   $0x79
  jmp alltraps
80106d67:	e9 34 f5 ff ff       	jmp    801062a0 <alltraps>

80106d6c <vector122>:
.globl vector122
vector122:
  pushl $0
80106d6c:	6a 00                	push   $0x0
  pushl $122
80106d6e:	6a 7a                	push   $0x7a
  jmp alltraps
80106d70:	e9 2b f5 ff ff       	jmp    801062a0 <alltraps>

80106d75 <vector123>:
.globl vector123
vector123:
  pushl $0
80106d75:	6a 00                	push   $0x0
  pushl $123
80106d77:	6a 7b                	push   $0x7b
  jmp alltraps
80106d79:	e9 22 f5 ff ff       	jmp    801062a0 <alltraps>

80106d7e <vector124>:
.globl vector124
vector124:
  pushl $0
80106d7e:	6a 00                	push   $0x0
  pushl $124
80106d80:	6a 7c                	push   $0x7c
  jmp alltraps
80106d82:	e9 19 f5 ff ff       	jmp    801062a0 <alltraps>

80106d87 <vector125>:
.globl vector125
vector125:
  pushl $0
80106d87:	6a 00                	push   $0x0
  pushl $125
80106d89:	6a 7d                	push   $0x7d
  jmp alltraps
80106d8b:	e9 10 f5 ff ff       	jmp    801062a0 <alltraps>

80106d90 <vector126>:
.globl vector126
vector126:
  pushl $0
80106d90:	6a 00                	push   $0x0
  pushl $126
80106d92:	6a 7e                	push   $0x7e
  jmp alltraps
80106d94:	e9 07 f5 ff ff       	jmp    801062a0 <alltraps>

80106d99 <vector127>:
.globl vector127
vector127:
  pushl $0
80106d99:	6a 00                	push   $0x0
  pushl $127
80106d9b:	6a 7f                	push   $0x7f
  jmp alltraps
80106d9d:	e9 fe f4 ff ff       	jmp    801062a0 <alltraps>

80106da2 <vector128>:
.globl vector128
vector128:
  pushl $0
80106da2:	6a 00                	push   $0x0
  pushl $128
80106da4:	68 80 00 00 00       	push   $0x80
  jmp alltraps
80106da9:	e9 f2 f4 ff ff       	jmp    801062a0 <alltraps>

80106dae <vector129>:
.globl vector129
vector129:
  pushl $0
80106dae:	6a 00                	push   $0x0
  pushl $129
80106db0:	68 81 00 00 00       	push   $0x81
  jmp alltraps
80106db5:	e9 e6 f4 ff ff       	jmp    801062a0 <alltraps>

80106dba <vector130>:
.globl vector130
vector130:
  pushl $0
80106dba:	6a 00                	push   $0x0
  pushl $130
80106dbc:	68 82 00 00 00       	push   $0x82
  jmp alltraps
80106dc1:	e9 da f4 ff ff       	jmp    801062a0 <alltraps>

80106dc6 <vector131>:
.globl vector131
vector131:
  pushl $0
80106dc6:	6a 00                	push   $0x0
  pushl $131
80106dc8:	68 83 00 00 00       	push   $0x83
  jmp alltraps
80106dcd:	e9 ce f4 ff ff       	jmp    801062a0 <alltraps>

80106dd2 <vector132>:
.globl vector132
vector132:
  pushl $0
80106dd2:	6a 00                	push   $0x0
  pushl $132
80106dd4:	68 84 00 00 00       	push   $0x84
  jmp alltraps
80106dd9:	e9 c2 f4 ff ff       	jmp    801062a0 <alltraps>

80106dde <vector133>:
.globl vector133
vector133:
  pushl $0
80106dde:	6a 00                	push   $0x0
  pushl $133
80106de0:	68 85 00 00 00       	push   $0x85
  jmp alltraps
80106de5:	e9 b6 f4 ff ff       	jmp    801062a0 <alltraps>

80106dea <vector134>:
.globl vector134
vector134:
  pushl $0
80106dea:	6a 00                	push   $0x0
  pushl $134
80106dec:	68 86 00 00 00       	push   $0x86
  jmp alltraps
80106df1:	e9 aa f4 ff ff       	jmp    801062a0 <alltraps>

80106df6 <vector135>:
.globl vector135
vector135:
  pushl $0
80106df6:	6a 00                	push   $0x0
  pushl $135
80106df8:	68 87 00 00 00       	push   $0x87
  jmp alltraps
80106dfd:	e9 9e f4 ff ff       	jmp    801062a0 <alltraps>

80106e02 <vector136>:
.globl vector136
vector136:
  pushl $0
80106e02:	6a 00                	push   $0x0
  pushl $136
80106e04:	68 88 00 00 00       	push   $0x88
  jmp alltraps
80106e09:	e9 92 f4 ff ff       	jmp    801062a0 <alltraps>

80106e0e <vector137>:
.globl vector137
vector137:
  pushl $0
80106e0e:	6a 00                	push   $0x0
  pushl $137
80106e10:	68 89 00 00 00       	push   $0x89
  jmp alltraps
80106e15:	e9 86 f4 ff ff       	jmp    801062a0 <alltraps>

80106e1a <vector138>:
.globl vector138
vector138:
  pushl $0
80106e1a:	6a 00                	push   $0x0
  pushl $138
80106e1c:	68 8a 00 00 00       	push   $0x8a
  jmp alltraps
80106e21:	e9 7a f4 ff ff       	jmp    801062a0 <alltraps>

80106e26 <vector139>:
.globl vector139
vector139:
  pushl $0
80106e26:	6a 00                	push   $0x0
  pushl $139
80106e28:	68 8b 00 00 00       	push   $0x8b
  jmp alltraps
80106e2d:	e9 6e f4 ff ff       	jmp    801062a0 <alltraps>

80106e32 <vector140>:
.globl vector140
vector140:
  pushl $0
80106e32:	6a 00                	push   $0x0
  pushl $140
80106e34:	68 8c 00 00 00       	push   $0x8c
  jmp alltraps
80106e39:	e9 62 f4 ff ff       	jmp    801062a0 <alltraps>

80106e3e <vector141>:
.globl vector141
vector141:
  pushl $0
80106e3e:	6a 00                	push   $0x0
  pushl $141
80106e40:	68 8d 00 00 00       	push   $0x8d
  jmp alltraps
80106e45:	e9 56 f4 ff ff       	jmp    801062a0 <alltraps>

80106e4a <vector142>:
.globl vector142
vector142:
  pushl $0
80106e4a:	6a 00                	push   $0x0
  pushl $142
80106e4c:	68 8e 00 00 00       	push   $0x8e
  jmp alltraps
80106e51:	e9 4a f4 ff ff       	jmp    801062a0 <alltraps>

80106e56 <vector143>:
.globl vector143
vector143:
  pushl $0
80106e56:	6a 00                	push   $0x0
  pushl $143
80106e58:	68 8f 00 00 00       	push   $0x8f
  jmp alltraps
80106e5d:	e9 3e f4 ff ff       	jmp    801062a0 <alltraps>

80106e62 <vector144>:
.globl vector144
vector144:
  pushl $0
80106e62:	6a 00                	push   $0x0
  pushl $144
80106e64:	68 90 00 00 00       	push   $0x90
  jmp alltraps
80106e69:	e9 32 f4 ff ff       	jmp    801062a0 <alltraps>

80106e6e <vector145>:
.globl vector145
vector145:
  pushl $0
80106e6e:	6a 00                	push   $0x0
  pushl $145
80106e70:	68 91 00 00 00       	push   $0x91
  jmp alltraps
80106e75:	e9 26 f4 ff ff       	jmp    801062a0 <alltraps>

80106e7a <vector146>:
.globl vector146
vector146:
  pushl $0
80106e7a:	6a 00                	push   $0x0
  pushl $146
80106e7c:	68 92 00 00 00       	push   $0x92
  jmp alltraps
80106e81:	e9 1a f4 ff ff       	jmp    801062a0 <alltraps>

80106e86 <vector147>:
.globl vector147
vector147:
  pushl $0
80106e86:	6a 00                	push   $0x0
  pushl $147
80106e88:	68 93 00 00 00       	push   $0x93
  jmp alltraps
80106e8d:	e9 0e f4 ff ff       	jmp    801062a0 <alltraps>

80106e92 <vector148>:
.globl vector148
vector148:
  pushl $0
80106e92:	6a 00                	push   $0x0
  pushl $148
80106e94:	68 94 00 00 00       	push   $0x94
  jmp alltraps
80106e99:	e9 02 f4 ff ff       	jmp    801062a0 <alltraps>

80106e9e <vector149>:
.globl vector149
vector149:
  pushl $0
80106e9e:	6a 00                	push   $0x0
  pushl $149
80106ea0:	68 95 00 00 00       	push   $0x95
  jmp alltraps
80106ea5:	e9 f6 f3 ff ff       	jmp    801062a0 <alltraps>

80106eaa <vector150>:
.globl vector150
vector150:
  pushl $0
80106eaa:	6a 00                	push   $0x0
  pushl $150
80106eac:	68 96 00 00 00       	push   $0x96
  jmp alltraps
80106eb1:	e9 ea f3 ff ff       	jmp    801062a0 <alltraps>

80106eb6 <vector151>:
.globl vector151
vector151:
  pushl $0
80106eb6:	6a 00                	push   $0x0
  pushl $151
80106eb8:	68 97 00 00 00       	push   $0x97
  jmp alltraps
80106ebd:	e9 de f3 ff ff       	jmp    801062a0 <alltraps>

80106ec2 <vector152>:
.globl vector152
vector152:
  pushl $0
80106ec2:	6a 00                	push   $0x0
  pushl $152
80106ec4:	68 98 00 00 00       	push   $0x98
  jmp alltraps
80106ec9:	e9 d2 f3 ff ff       	jmp    801062a0 <alltraps>

80106ece <vector153>:
.globl vector153
vector153:
  pushl $0
80106ece:	6a 00                	push   $0x0
  pushl $153
80106ed0:	68 99 00 00 00       	push   $0x99
  jmp alltraps
80106ed5:	e9 c6 f3 ff ff       	jmp    801062a0 <alltraps>

80106eda <vector154>:
.globl vector154
vector154:
  pushl $0
80106eda:	6a 00                	push   $0x0
  pushl $154
80106edc:	68 9a 00 00 00       	push   $0x9a
  jmp alltraps
80106ee1:	e9 ba f3 ff ff       	jmp    801062a0 <alltraps>

80106ee6 <vector155>:
.globl vector155
vector155:
  pushl $0
80106ee6:	6a 00                	push   $0x0
  pushl $155
80106ee8:	68 9b 00 00 00       	push   $0x9b
  jmp alltraps
80106eed:	e9 ae f3 ff ff       	jmp    801062a0 <alltraps>

80106ef2 <vector156>:
.globl vector156
vector156:
  pushl $0
80106ef2:	6a 00                	push   $0x0
  pushl $156
80106ef4:	68 9c 00 00 00       	push   $0x9c
  jmp alltraps
80106ef9:	e9 a2 f3 ff ff       	jmp    801062a0 <alltraps>

80106efe <vector157>:
.globl vector157
vector157:
  pushl $0
80106efe:	6a 00                	push   $0x0
  pushl $157
80106f00:	68 9d 00 00 00       	push   $0x9d
  jmp alltraps
80106f05:	e9 96 f3 ff ff       	jmp    801062a0 <alltraps>

80106f0a <vector158>:
.globl vector158
vector158:
  pushl $0
80106f0a:	6a 00                	push   $0x0
  pushl $158
80106f0c:	68 9e 00 00 00       	push   $0x9e
  jmp alltraps
80106f11:	e9 8a f3 ff ff       	jmp    801062a0 <alltraps>

80106f16 <vector159>:
.globl vector159
vector159:
  pushl $0
80106f16:	6a 00                	push   $0x0
  pushl $159
80106f18:	68 9f 00 00 00       	push   $0x9f
  jmp alltraps
80106f1d:	e9 7e f3 ff ff       	jmp    801062a0 <alltraps>

80106f22 <vector160>:
.globl vector160
vector160:
  pushl $0
80106f22:	6a 00                	push   $0x0
  pushl $160
80106f24:	68 a0 00 00 00       	push   $0xa0
  jmp alltraps
80106f29:	e9 72 f3 ff ff       	jmp    801062a0 <alltraps>

80106f2e <vector161>:
.globl vector161
vector161:
  pushl $0
80106f2e:	6a 00                	push   $0x0
  pushl $161
80106f30:	68 a1 00 00 00       	push   $0xa1
  jmp alltraps
80106f35:	e9 66 f3 ff ff       	jmp    801062a0 <alltraps>

80106f3a <vector162>:
.globl vector162
vector162:
  pushl $0
80106f3a:	6a 00                	push   $0x0
  pushl $162
80106f3c:	68 a2 00 00 00       	push   $0xa2
  jmp alltraps
80106f41:	e9 5a f3 ff ff       	jmp    801062a0 <alltraps>

80106f46 <vector163>:
.globl vector163
vector163:
  pushl $0
80106f46:	6a 00                	push   $0x0
  pushl $163
80106f48:	68 a3 00 00 00       	push   $0xa3
  jmp alltraps
80106f4d:	e9 4e f3 ff ff       	jmp    801062a0 <alltraps>

80106f52 <vector164>:
.globl vector164
vector164:
  pushl $0
80106f52:	6a 00                	push   $0x0
  pushl $164
80106f54:	68 a4 00 00 00       	push   $0xa4
  jmp alltraps
80106f59:	e9 42 f3 ff ff       	jmp    801062a0 <alltraps>

80106f5e <vector165>:
.globl vector165
vector165:
  pushl $0
80106f5e:	6a 00                	push   $0x0
  pushl $165
80106f60:	68 a5 00 00 00       	push   $0xa5
  jmp alltraps
80106f65:	e9 36 f3 ff ff       	jmp    801062a0 <alltraps>

80106f6a <vector166>:
.globl vector166
vector166:
  pushl $0
80106f6a:	6a 00                	push   $0x0
  pushl $166
80106f6c:	68 a6 00 00 00       	push   $0xa6
  jmp alltraps
80106f71:	e9 2a f3 ff ff       	jmp    801062a0 <alltraps>

80106f76 <vector167>:
.globl vector167
vector167:
  pushl $0
80106f76:	6a 00                	push   $0x0
  pushl $167
80106f78:	68 a7 00 00 00       	push   $0xa7
  jmp alltraps
80106f7d:	e9 1e f3 ff ff       	jmp    801062a0 <alltraps>

80106f82 <vector168>:
.globl vector168
vector168:
  pushl $0
80106f82:	6a 00                	push   $0x0
  pushl $168
80106f84:	68 a8 00 00 00       	push   $0xa8
  jmp alltraps
80106f89:	e9 12 f3 ff ff       	jmp    801062a0 <alltraps>

80106f8e <vector169>:
.globl vector169
vector169:
  pushl $0
80106f8e:	6a 00                	push   $0x0
  pushl $169
80106f90:	68 a9 00 00 00       	push   $0xa9
  jmp alltraps
80106f95:	e9 06 f3 ff ff       	jmp    801062a0 <alltraps>

80106f9a <vector170>:
.globl vector170
vector170:
  pushl $0
80106f9a:	6a 00                	push   $0x0
  pushl $170
80106f9c:	68 aa 00 00 00       	push   $0xaa
  jmp alltraps
80106fa1:	e9 fa f2 ff ff       	jmp    801062a0 <alltraps>

80106fa6 <vector171>:
.globl vector171
vector171:
  pushl $0
80106fa6:	6a 00                	push   $0x0
  pushl $171
80106fa8:	68 ab 00 00 00       	push   $0xab
  jmp alltraps
80106fad:	e9 ee f2 ff ff       	jmp    801062a0 <alltraps>

80106fb2 <vector172>:
.globl vector172
vector172:
  pushl $0
80106fb2:	6a 00                	push   $0x0
  pushl $172
80106fb4:	68 ac 00 00 00       	push   $0xac
  jmp alltraps
80106fb9:	e9 e2 f2 ff ff       	jmp    801062a0 <alltraps>

80106fbe <vector173>:
.globl vector173
vector173:
  pushl $0
80106fbe:	6a 00                	push   $0x0
  pushl $173
80106fc0:	68 ad 00 00 00       	push   $0xad
  jmp alltraps
80106fc5:	e9 d6 f2 ff ff       	jmp    801062a0 <alltraps>

80106fca <vector174>:
.globl vector174
vector174:
  pushl $0
80106fca:	6a 00                	push   $0x0
  pushl $174
80106fcc:	68 ae 00 00 00       	push   $0xae
  jmp alltraps
80106fd1:	e9 ca f2 ff ff       	jmp    801062a0 <alltraps>

80106fd6 <vector175>:
.globl vector175
vector175:
  pushl $0
80106fd6:	6a 00                	push   $0x0
  pushl $175
80106fd8:	68 af 00 00 00       	push   $0xaf
  jmp alltraps
80106fdd:	e9 be f2 ff ff       	jmp    801062a0 <alltraps>

80106fe2 <vector176>:
.globl vector176
vector176:
  pushl $0
80106fe2:	6a 00                	push   $0x0
  pushl $176
80106fe4:	68 b0 00 00 00       	push   $0xb0
  jmp alltraps
80106fe9:	e9 b2 f2 ff ff       	jmp    801062a0 <alltraps>

80106fee <vector177>:
.globl vector177
vector177:
  pushl $0
80106fee:	6a 00                	push   $0x0
  pushl $177
80106ff0:	68 b1 00 00 00       	push   $0xb1
  jmp alltraps
80106ff5:	e9 a6 f2 ff ff       	jmp    801062a0 <alltraps>

80106ffa <vector178>:
.globl vector178
vector178:
  pushl $0
80106ffa:	6a 00                	push   $0x0
  pushl $178
80106ffc:	68 b2 00 00 00       	push   $0xb2
  jmp alltraps
80107001:	e9 9a f2 ff ff       	jmp    801062a0 <alltraps>

80107006 <vector179>:
.globl vector179
vector179:
  pushl $0
80107006:	6a 00                	push   $0x0
  pushl $179
80107008:	68 b3 00 00 00       	push   $0xb3
  jmp alltraps
8010700d:	e9 8e f2 ff ff       	jmp    801062a0 <alltraps>

80107012 <vector180>:
.globl vector180
vector180:
  pushl $0
80107012:	6a 00                	push   $0x0
  pushl $180
80107014:	68 b4 00 00 00       	push   $0xb4
  jmp alltraps
80107019:	e9 82 f2 ff ff       	jmp    801062a0 <alltraps>

8010701e <vector181>:
.globl vector181
vector181:
  pushl $0
8010701e:	6a 00                	push   $0x0
  pushl $181
80107020:	68 b5 00 00 00       	push   $0xb5
  jmp alltraps
80107025:	e9 76 f2 ff ff       	jmp    801062a0 <alltraps>

8010702a <vector182>:
.globl vector182
vector182:
  pushl $0
8010702a:	6a 00                	push   $0x0
  pushl $182
8010702c:	68 b6 00 00 00       	push   $0xb6
  jmp alltraps
80107031:	e9 6a f2 ff ff       	jmp    801062a0 <alltraps>

80107036 <vector183>:
.globl vector183
vector183:
  pushl $0
80107036:	6a 00                	push   $0x0
  pushl $183
80107038:	68 b7 00 00 00       	push   $0xb7
  jmp alltraps
8010703d:	e9 5e f2 ff ff       	jmp    801062a0 <alltraps>

80107042 <vector184>:
.globl vector184
vector184:
  pushl $0
80107042:	6a 00                	push   $0x0
  pushl $184
80107044:	68 b8 00 00 00       	push   $0xb8
  jmp alltraps
80107049:	e9 52 f2 ff ff       	jmp    801062a0 <alltraps>

8010704e <vector185>:
.globl vector185
vector185:
  pushl $0
8010704e:	6a 00                	push   $0x0
  pushl $185
80107050:	68 b9 00 00 00       	push   $0xb9
  jmp alltraps
80107055:	e9 46 f2 ff ff       	jmp    801062a0 <alltraps>

8010705a <vector186>:
.globl vector186
vector186:
  pushl $0
8010705a:	6a 00                	push   $0x0
  pushl $186
8010705c:	68 ba 00 00 00       	push   $0xba
  jmp alltraps
80107061:	e9 3a f2 ff ff       	jmp    801062a0 <alltraps>

80107066 <vector187>:
.globl vector187
vector187:
  pushl $0
80107066:	6a 00                	push   $0x0
  pushl $187
80107068:	68 bb 00 00 00       	push   $0xbb
  jmp alltraps
8010706d:	e9 2e f2 ff ff       	jmp    801062a0 <alltraps>

80107072 <vector188>:
.globl vector188
vector188:
  pushl $0
80107072:	6a 00                	push   $0x0
  pushl $188
80107074:	68 bc 00 00 00       	push   $0xbc
  jmp alltraps
80107079:	e9 22 f2 ff ff       	jmp    801062a0 <alltraps>

8010707e <vector189>:
.globl vector189
vector189:
  pushl $0
8010707e:	6a 00                	push   $0x0
  pushl $189
80107080:	68 bd 00 00 00       	push   $0xbd
  jmp alltraps
80107085:	e9 16 f2 ff ff       	jmp    801062a0 <alltraps>

8010708a <vector190>:
.globl vector190
vector190:
  pushl $0
8010708a:	6a 00                	push   $0x0
  pushl $190
8010708c:	68 be 00 00 00       	push   $0xbe
  jmp alltraps
80107091:	e9 0a f2 ff ff       	jmp    801062a0 <alltraps>

80107096 <vector191>:
.globl vector191
vector191:
  pushl $0
80107096:	6a 00                	push   $0x0
  pushl $191
80107098:	68 bf 00 00 00       	push   $0xbf
  jmp alltraps
8010709d:	e9 fe f1 ff ff       	jmp    801062a0 <alltraps>

801070a2 <vector192>:
.globl vector192
vector192:
  pushl $0
801070a2:	6a 00                	push   $0x0
  pushl $192
801070a4:	68 c0 00 00 00       	push   $0xc0
  jmp alltraps
801070a9:	e9 f2 f1 ff ff       	jmp    801062a0 <alltraps>

801070ae <vector193>:
.globl vector193
vector193:
  pushl $0
801070ae:	6a 00                	push   $0x0
  pushl $193
801070b0:	68 c1 00 00 00       	push   $0xc1
  jmp alltraps
801070b5:	e9 e6 f1 ff ff       	jmp    801062a0 <alltraps>

801070ba <vector194>:
.globl vector194
vector194:
  pushl $0
801070ba:	6a 00                	push   $0x0
  pushl $194
801070bc:	68 c2 00 00 00       	push   $0xc2
  jmp alltraps
801070c1:	e9 da f1 ff ff       	jmp    801062a0 <alltraps>

801070c6 <vector195>:
.globl vector195
vector195:
  pushl $0
801070c6:	6a 00                	push   $0x0
  pushl $195
801070c8:	68 c3 00 00 00       	push   $0xc3
  jmp alltraps
801070cd:	e9 ce f1 ff ff       	jmp    801062a0 <alltraps>

801070d2 <vector196>:
.globl vector196
vector196:
  pushl $0
801070d2:	6a 00                	push   $0x0
  pushl $196
801070d4:	68 c4 00 00 00       	push   $0xc4
  jmp alltraps
801070d9:	e9 c2 f1 ff ff       	jmp    801062a0 <alltraps>

801070de <vector197>:
.globl vector197
vector197:
  pushl $0
801070de:	6a 00                	push   $0x0
  pushl $197
801070e0:	68 c5 00 00 00       	push   $0xc5
  jmp alltraps
801070e5:	e9 b6 f1 ff ff       	jmp    801062a0 <alltraps>

801070ea <vector198>:
.globl vector198
vector198:
  pushl $0
801070ea:	6a 00                	push   $0x0
  pushl $198
801070ec:	68 c6 00 00 00       	push   $0xc6
  jmp alltraps
801070f1:	e9 aa f1 ff ff       	jmp    801062a0 <alltraps>

801070f6 <vector199>:
.globl vector199
vector199:
  pushl $0
801070f6:	6a 00                	push   $0x0
  pushl $199
801070f8:	68 c7 00 00 00       	push   $0xc7
  jmp alltraps
801070fd:	e9 9e f1 ff ff       	jmp    801062a0 <alltraps>

80107102 <vector200>:
.globl vector200
vector200:
  pushl $0
80107102:	6a 00                	push   $0x0
  pushl $200
80107104:	68 c8 00 00 00       	push   $0xc8
  jmp alltraps
80107109:	e9 92 f1 ff ff       	jmp    801062a0 <alltraps>

8010710e <vector201>:
.globl vector201
vector201:
  pushl $0
8010710e:	6a 00                	push   $0x0
  pushl $201
80107110:	68 c9 00 00 00       	push   $0xc9
  jmp alltraps
80107115:	e9 86 f1 ff ff       	jmp    801062a0 <alltraps>

8010711a <vector202>:
.globl vector202
vector202:
  pushl $0
8010711a:	6a 00                	push   $0x0
  pushl $202
8010711c:	68 ca 00 00 00       	push   $0xca
  jmp alltraps
80107121:	e9 7a f1 ff ff       	jmp    801062a0 <alltraps>

80107126 <vector203>:
.globl vector203
vector203:
  pushl $0
80107126:	6a 00                	push   $0x0
  pushl $203
80107128:	68 cb 00 00 00       	push   $0xcb
  jmp alltraps
8010712d:	e9 6e f1 ff ff       	jmp    801062a0 <alltraps>

80107132 <vector204>:
.globl vector204
vector204:
  pushl $0
80107132:	6a 00                	push   $0x0
  pushl $204
80107134:	68 cc 00 00 00       	push   $0xcc
  jmp alltraps
80107139:	e9 62 f1 ff ff       	jmp    801062a0 <alltraps>

8010713e <vector205>:
.globl vector205
vector205:
  pushl $0
8010713e:	6a 00                	push   $0x0
  pushl $205
80107140:	68 cd 00 00 00       	push   $0xcd
  jmp alltraps
80107145:	e9 56 f1 ff ff       	jmp    801062a0 <alltraps>

8010714a <vector206>:
.globl vector206
vector206:
  pushl $0
8010714a:	6a 00                	push   $0x0
  pushl $206
8010714c:	68 ce 00 00 00       	push   $0xce
  jmp alltraps
80107151:	e9 4a f1 ff ff       	jmp    801062a0 <alltraps>

80107156 <vector207>:
.globl vector207
vector207:
  pushl $0
80107156:	6a 00                	push   $0x0
  pushl $207
80107158:	68 cf 00 00 00       	push   $0xcf
  jmp alltraps
8010715d:	e9 3e f1 ff ff       	jmp    801062a0 <alltraps>

80107162 <vector208>:
.globl vector208
vector208:
  pushl $0
80107162:	6a 00                	push   $0x0
  pushl $208
80107164:	68 d0 00 00 00       	push   $0xd0
  jmp alltraps
80107169:	e9 32 f1 ff ff       	jmp    801062a0 <alltraps>

8010716e <vector209>:
.globl vector209
vector209:
  pushl $0
8010716e:	6a 00                	push   $0x0
  pushl $209
80107170:	68 d1 00 00 00       	push   $0xd1
  jmp alltraps
80107175:	e9 26 f1 ff ff       	jmp    801062a0 <alltraps>

8010717a <vector210>:
.globl vector210
vector210:
  pushl $0
8010717a:	6a 00                	push   $0x0
  pushl $210
8010717c:	68 d2 00 00 00       	push   $0xd2
  jmp alltraps
80107181:	e9 1a f1 ff ff       	jmp    801062a0 <alltraps>

80107186 <vector211>:
.globl vector211
vector211:
  pushl $0
80107186:	6a 00                	push   $0x0
  pushl $211
80107188:	68 d3 00 00 00       	push   $0xd3
  jmp alltraps
8010718d:	e9 0e f1 ff ff       	jmp    801062a0 <alltraps>

80107192 <vector212>:
.globl vector212
vector212:
  pushl $0
80107192:	6a 00                	push   $0x0
  pushl $212
80107194:	68 d4 00 00 00       	push   $0xd4
  jmp alltraps
80107199:	e9 02 f1 ff ff       	jmp    801062a0 <alltraps>

8010719e <vector213>:
.globl vector213
vector213:
  pushl $0
8010719e:	6a 00                	push   $0x0
  pushl $213
801071a0:	68 d5 00 00 00       	push   $0xd5
  jmp alltraps
801071a5:	e9 f6 f0 ff ff       	jmp    801062a0 <alltraps>

801071aa <vector214>:
.globl vector214
vector214:
  pushl $0
801071aa:	6a 00                	push   $0x0
  pushl $214
801071ac:	68 d6 00 00 00       	push   $0xd6
  jmp alltraps
801071b1:	e9 ea f0 ff ff       	jmp    801062a0 <alltraps>

801071b6 <vector215>:
.globl vector215
vector215:
  pushl $0
801071b6:	6a 00                	push   $0x0
  pushl $215
801071b8:	68 d7 00 00 00       	push   $0xd7
  jmp alltraps
801071bd:	e9 de f0 ff ff       	jmp    801062a0 <alltraps>

801071c2 <vector216>:
.globl vector216
vector216:
  pushl $0
801071c2:	6a 00                	push   $0x0
  pushl $216
801071c4:	68 d8 00 00 00       	push   $0xd8
  jmp alltraps
801071c9:	e9 d2 f0 ff ff       	jmp    801062a0 <alltraps>

801071ce <vector217>:
.globl vector217
vector217:
  pushl $0
801071ce:	6a 00                	push   $0x0
  pushl $217
801071d0:	68 d9 00 00 00       	push   $0xd9
  jmp alltraps
801071d5:	e9 c6 f0 ff ff       	jmp    801062a0 <alltraps>

801071da <vector218>:
.globl vector218
vector218:
  pushl $0
801071da:	6a 00                	push   $0x0
  pushl $218
801071dc:	68 da 00 00 00       	push   $0xda
  jmp alltraps
801071e1:	e9 ba f0 ff ff       	jmp    801062a0 <alltraps>

801071e6 <vector219>:
.globl vector219
vector219:
  pushl $0
801071e6:	6a 00                	push   $0x0
  pushl $219
801071e8:	68 db 00 00 00       	push   $0xdb
  jmp alltraps
801071ed:	e9 ae f0 ff ff       	jmp    801062a0 <alltraps>

801071f2 <vector220>:
.globl vector220
vector220:
  pushl $0
801071f2:	6a 00                	push   $0x0
  pushl $220
801071f4:	68 dc 00 00 00       	push   $0xdc
  jmp alltraps
801071f9:	e9 a2 f0 ff ff       	jmp    801062a0 <alltraps>

801071fe <vector221>:
.globl vector221
vector221:
  pushl $0
801071fe:	6a 00                	push   $0x0
  pushl $221
80107200:	68 dd 00 00 00       	push   $0xdd
  jmp alltraps
80107205:	e9 96 f0 ff ff       	jmp    801062a0 <alltraps>

8010720a <vector222>:
.globl vector222
vector222:
  pushl $0
8010720a:	6a 00                	push   $0x0
  pushl $222
8010720c:	68 de 00 00 00       	push   $0xde
  jmp alltraps
80107211:	e9 8a f0 ff ff       	jmp    801062a0 <alltraps>

80107216 <vector223>:
.globl vector223
vector223:
  pushl $0
80107216:	6a 00                	push   $0x0
  pushl $223
80107218:	68 df 00 00 00       	push   $0xdf
  jmp alltraps
8010721d:	e9 7e f0 ff ff       	jmp    801062a0 <alltraps>

80107222 <vector224>:
.globl vector224
vector224:
  pushl $0
80107222:	6a 00                	push   $0x0
  pushl $224
80107224:	68 e0 00 00 00       	push   $0xe0
  jmp alltraps
80107229:	e9 72 f0 ff ff       	jmp    801062a0 <alltraps>

8010722e <vector225>:
.globl vector225
vector225:
  pushl $0
8010722e:	6a 00                	push   $0x0
  pushl $225
80107230:	68 e1 00 00 00       	push   $0xe1
  jmp alltraps
80107235:	e9 66 f0 ff ff       	jmp    801062a0 <alltraps>

8010723a <vector226>:
.globl vector226
vector226:
  pushl $0
8010723a:	6a 00                	push   $0x0
  pushl $226
8010723c:	68 e2 00 00 00       	push   $0xe2
  jmp alltraps
80107241:	e9 5a f0 ff ff       	jmp    801062a0 <alltraps>

80107246 <vector227>:
.globl vector227
vector227:
  pushl $0
80107246:	6a 00                	push   $0x0
  pushl $227
80107248:	68 e3 00 00 00       	push   $0xe3
  jmp alltraps
8010724d:	e9 4e f0 ff ff       	jmp    801062a0 <alltraps>

80107252 <vector228>:
.globl vector228
vector228:
  pushl $0
80107252:	6a 00                	push   $0x0
  pushl $228
80107254:	68 e4 00 00 00       	push   $0xe4
  jmp alltraps
80107259:	e9 42 f0 ff ff       	jmp    801062a0 <alltraps>

8010725e <vector229>:
.globl vector229
vector229:
  pushl $0
8010725e:	6a 00                	push   $0x0
  pushl $229
80107260:	68 e5 00 00 00       	push   $0xe5
  jmp alltraps
80107265:	e9 36 f0 ff ff       	jmp    801062a0 <alltraps>

8010726a <vector230>:
.globl vector230
vector230:
  pushl $0
8010726a:	6a 00                	push   $0x0
  pushl $230
8010726c:	68 e6 00 00 00       	push   $0xe6
  jmp alltraps
80107271:	e9 2a f0 ff ff       	jmp    801062a0 <alltraps>

80107276 <vector231>:
.globl vector231
vector231:
  pushl $0
80107276:	6a 00                	push   $0x0
  pushl $231
80107278:	68 e7 00 00 00       	push   $0xe7
  jmp alltraps
8010727d:	e9 1e f0 ff ff       	jmp    801062a0 <alltraps>

80107282 <vector232>:
.globl vector232
vector232:
  pushl $0
80107282:	6a 00                	push   $0x0
  pushl $232
80107284:	68 e8 00 00 00       	push   $0xe8
  jmp alltraps
80107289:	e9 12 f0 ff ff       	jmp    801062a0 <alltraps>

8010728e <vector233>:
.globl vector233
vector233:
  pushl $0
8010728e:	6a 00                	push   $0x0
  pushl $233
80107290:	68 e9 00 00 00       	push   $0xe9
  jmp alltraps
80107295:	e9 06 f0 ff ff       	jmp    801062a0 <alltraps>

8010729a <vector234>:
.globl vector234
vector234:
  pushl $0
8010729a:	6a 00                	push   $0x0
  pushl $234
8010729c:	68 ea 00 00 00       	push   $0xea
  jmp alltraps
801072a1:	e9 fa ef ff ff       	jmp    801062a0 <alltraps>

801072a6 <vector235>:
.globl vector235
vector235:
  pushl $0
801072a6:	6a 00                	push   $0x0
  pushl $235
801072a8:	68 eb 00 00 00       	push   $0xeb
  jmp alltraps
801072ad:	e9 ee ef ff ff       	jmp    801062a0 <alltraps>

801072b2 <vector236>:
.globl vector236
vector236:
  pushl $0
801072b2:	6a 00                	push   $0x0
  pushl $236
801072b4:	68 ec 00 00 00       	push   $0xec
  jmp alltraps
801072b9:	e9 e2 ef ff ff       	jmp    801062a0 <alltraps>

801072be <vector237>:
.globl vector237
vector237:
  pushl $0
801072be:	6a 00                	push   $0x0
  pushl $237
801072c0:	68 ed 00 00 00       	push   $0xed
  jmp alltraps
801072c5:	e9 d6 ef ff ff       	jmp    801062a0 <alltraps>

801072ca <vector238>:
.globl vector238
vector238:
  pushl $0
801072ca:	6a 00                	push   $0x0
  pushl $238
801072cc:	68 ee 00 00 00       	push   $0xee
  jmp alltraps
801072d1:	e9 ca ef ff ff       	jmp    801062a0 <alltraps>

801072d6 <vector239>:
.globl vector239
vector239:
  pushl $0
801072d6:	6a 00                	push   $0x0
  pushl $239
801072d8:	68 ef 00 00 00       	push   $0xef
  jmp alltraps
801072dd:	e9 be ef ff ff       	jmp    801062a0 <alltraps>

801072e2 <vector240>:
.globl vector240
vector240:
  pushl $0
801072e2:	6a 00                	push   $0x0
  pushl $240
801072e4:	68 f0 00 00 00       	push   $0xf0
  jmp alltraps
801072e9:	e9 b2 ef ff ff       	jmp    801062a0 <alltraps>

801072ee <vector241>:
.globl vector241
vector241:
  pushl $0
801072ee:	6a 00                	push   $0x0
  pushl $241
801072f0:	68 f1 00 00 00       	push   $0xf1
  jmp alltraps
801072f5:	e9 a6 ef ff ff       	jmp    801062a0 <alltraps>

801072fa <vector242>:
.globl vector242
vector242:
  pushl $0
801072fa:	6a 00                	push   $0x0
  pushl $242
801072fc:	68 f2 00 00 00       	push   $0xf2
  jmp alltraps
80107301:	e9 9a ef ff ff       	jmp    801062a0 <alltraps>

80107306 <vector243>:
.globl vector243
vector243:
  pushl $0
80107306:	6a 00                	push   $0x0
  pushl $243
80107308:	68 f3 00 00 00       	push   $0xf3
  jmp alltraps
8010730d:	e9 8e ef ff ff       	jmp    801062a0 <alltraps>

80107312 <vector244>:
.globl vector244
vector244:
  pushl $0
80107312:	6a 00                	push   $0x0
  pushl $244
80107314:	68 f4 00 00 00       	push   $0xf4
  jmp alltraps
80107319:	e9 82 ef ff ff       	jmp    801062a0 <alltraps>

8010731e <vector245>:
.globl vector245
vector245:
  pushl $0
8010731e:	6a 00                	push   $0x0
  pushl $245
80107320:	68 f5 00 00 00       	push   $0xf5
  jmp alltraps
80107325:	e9 76 ef ff ff       	jmp    801062a0 <alltraps>

8010732a <vector246>:
.globl vector246
vector246:
  pushl $0
8010732a:	6a 00                	push   $0x0
  pushl $246
8010732c:	68 f6 00 00 00       	push   $0xf6
  jmp alltraps
80107331:	e9 6a ef ff ff       	jmp    801062a0 <alltraps>

80107336 <vector247>:
.globl vector247
vector247:
  pushl $0
80107336:	6a 00                	push   $0x0
  pushl $247
80107338:	68 f7 00 00 00       	push   $0xf7
  jmp alltraps
8010733d:	e9 5e ef ff ff       	jmp    801062a0 <alltraps>

80107342 <vector248>:
.globl vector248
vector248:
  pushl $0
80107342:	6a 00                	push   $0x0
  pushl $248
80107344:	68 f8 00 00 00       	push   $0xf8
  jmp alltraps
80107349:	e9 52 ef ff ff       	jmp    801062a0 <alltraps>

8010734e <vector249>:
.globl vector249
vector249:
  pushl $0
8010734e:	6a 00                	push   $0x0
  pushl $249
80107350:	68 f9 00 00 00       	push   $0xf9
  jmp alltraps
80107355:	e9 46 ef ff ff       	jmp    801062a0 <alltraps>

8010735a <vector250>:
.globl vector250
vector250:
  pushl $0
8010735a:	6a 00                	push   $0x0
  pushl $250
8010735c:	68 fa 00 00 00       	push   $0xfa
  jmp alltraps
80107361:	e9 3a ef ff ff       	jmp    801062a0 <alltraps>

80107366 <vector251>:
.globl vector251
vector251:
  pushl $0
80107366:	6a 00                	push   $0x0
  pushl $251
80107368:	68 fb 00 00 00       	push   $0xfb
  jmp alltraps
8010736d:	e9 2e ef ff ff       	jmp    801062a0 <alltraps>

80107372 <vector252>:
.globl vector252
vector252:
  pushl $0
80107372:	6a 00                	push   $0x0
  pushl $252
80107374:	68 fc 00 00 00       	push   $0xfc
  jmp alltraps
80107379:	e9 22 ef ff ff       	jmp    801062a0 <alltraps>

8010737e <vector253>:
.globl vector253
vector253:
  pushl $0
8010737e:	6a 00                	push   $0x0
  pushl $253
80107380:	68 fd 00 00 00       	push   $0xfd
  jmp alltraps
80107385:	e9 16 ef ff ff       	jmp    801062a0 <alltraps>

8010738a <vector254>:
.globl vector254
vector254:
  pushl $0
8010738a:	6a 00                	push   $0x0
  pushl $254
8010738c:	68 fe 00 00 00       	push   $0xfe
  jmp alltraps
80107391:	e9 0a ef ff ff       	jmp    801062a0 <alltraps>

80107396 <vector255>:
.globl vector255
vector255:
  pushl $0
80107396:	6a 00                	push   $0x0
  pushl $255
80107398:	68 ff 00 00 00       	push   $0xff
  jmp alltraps
8010739d:	e9 fe ee ff ff       	jmp    801062a0 <alltraps>
	...

801073a4 <lgdt>:

struct segdesc;

static inline void
lgdt(struct segdesc *p, int size)
{
801073a4:	55                   	push   %ebp
801073a5:	89 e5                	mov    %esp,%ebp
801073a7:	83 ec 10             	sub    $0x10,%esp
  volatile ushort pd[3];

  pd[0] = size-1;
801073aa:	8b 45 0c             	mov    0xc(%ebp),%eax
801073ad:	83 e8 01             	sub    $0x1,%eax
801073b0:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
  pd[1] = (uint)p;
801073b4:	8b 45 08             	mov    0x8(%ebp),%eax
801073b7:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  pd[2] = (uint)p >> 16;
801073bb:	8b 45 08             	mov    0x8(%ebp),%eax
801073be:	c1 e8 10             	shr    $0x10,%eax
801073c1:	66 89 45 fe          	mov    %ax,-0x2(%ebp)

  asm volatile("lgdt (%0)" : : "r" (pd));
801073c5:	8d 45 fa             	lea    -0x6(%ebp),%eax
801073c8:	0f 01 10             	lgdtl  (%eax)
}
801073cb:	c9                   	leave  
801073cc:	c3                   	ret    

801073cd <ltr>:
  asm volatile("lidt (%0)" : : "r" (pd));
}

static inline void
ltr(ushort sel)
{
801073cd:	55                   	push   %ebp
801073ce:	89 e5                	mov    %esp,%ebp
801073d0:	83 ec 04             	sub    $0x4,%esp
801073d3:	8b 45 08             	mov    0x8(%ebp),%eax
801073d6:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  asm volatile("ltr %0" : : "r" (sel));
801073da:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
801073de:	0f 00 d8             	ltr    %ax
}
801073e1:	c9                   	leave  
801073e2:	c3                   	ret    

801073e3 <loadgs>:
  return eflags;
}

static inline void
loadgs(ushort v)
{
801073e3:	55                   	push   %ebp
801073e4:	89 e5                	mov    %esp,%ebp
801073e6:	83 ec 04             	sub    $0x4,%esp
801073e9:	8b 45 08             	mov    0x8(%ebp),%eax
801073ec:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  asm volatile("movw %0, %%gs" : : "r" (v));
801073f0:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
801073f4:	8e e8                	mov    %eax,%gs
}
801073f6:	c9                   	leave  
801073f7:	c3                   	ret    

801073f8 <lcr3>:
  return val;
}

static inline void
lcr3(uint val) 
{
801073f8:	55                   	push   %ebp
801073f9:	89 e5                	mov    %esp,%ebp
  asm volatile("movl %0,%%cr3" : : "r" (val));
801073fb:	8b 45 08             	mov    0x8(%ebp),%eax
801073fe:	0f 22 d8             	mov    %eax,%cr3
}
80107401:	5d                   	pop    %ebp
80107402:	c3                   	ret    

80107403 <v2p>:
#define KERNBASE 0x80000000         // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM)  // Address where kernel is linked

#ifndef __ASSEMBLER__

static inline uint v2p(void *a) { return ((uint) (a))  - KERNBASE; }
80107403:	55                   	push   %ebp
80107404:	89 e5                	mov    %esp,%ebp
80107406:	8b 45 08             	mov    0x8(%ebp),%eax
80107409:	05 00 00 00 80       	add    $0x80000000,%eax
8010740e:	5d                   	pop    %ebp
8010740f:	c3                   	ret    

80107410 <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
80107410:	55                   	push   %ebp
80107411:	89 e5                	mov    %esp,%ebp
80107413:	8b 45 08             	mov    0x8(%ebp),%eax
80107416:	05 00 00 00 80       	add    $0x80000000,%eax
8010741b:	5d                   	pop    %ebp
8010741c:	c3                   	ret    

8010741d <seginit>:

// Set up CPU's kernel segment descriptors.
// Run once on entry on each CPU.
void
seginit(void)
{
8010741d:	55                   	push   %ebp
8010741e:	89 e5                	mov    %esp,%ebp
80107420:	53                   	push   %ebx
80107421:	83 ec 24             	sub    $0x24,%esp

  // Map "logical" addresses to virtual addresses using identity map.
  // Cannot share a CODE descriptor for both kernel and user
  // because it would have to have DPL_USR, but the CPU forbids
  // an interrupt from CPL=0 to DPL=3.
  c = &cpus[cpunum()];
80107424:	e8 78 bb ff ff       	call   80102fa1 <cpunum>
80107429:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
8010742f:	05 40 09 11 80       	add    $0x80110940,%eax
80107434:	89 45 f4             	mov    %eax,-0xc(%ebp)
  c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
80107437:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010743a:	66 c7 40 78 ff ff    	movw   $0xffff,0x78(%eax)
80107440:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107443:	66 c7 40 7a 00 00    	movw   $0x0,0x7a(%eax)
80107449:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010744c:	c6 40 7c 00          	movb   $0x0,0x7c(%eax)
80107450:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107453:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
80107457:	83 e2 f0             	and    $0xfffffff0,%edx
8010745a:	83 ca 0a             	or     $0xa,%edx
8010745d:	88 50 7d             	mov    %dl,0x7d(%eax)
80107460:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107463:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
80107467:	83 ca 10             	or     $0x10,%edx
8010746a:	88 50 7d             	mov    %dl,0x7d(%eax)
8010746d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107470:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
80107474:	83 e2 9f             	and    $0xffffff9f,%edx
80107477:	88 50 7d             	mov    %dl,0x7d(%eax)
8010747a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010747d:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
80107481:	83 ca 80             	or     $0xffffff80,%edx
80107484:	88 50 7d             	mov    %dl,0x7d(%eax)
80107487:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010748a:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
8010748e:	83 ca 0f             	or     $0xf,%edx
80107491:	88 50 7e             	mov    %dl,0x7e(%eax)
80107494:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107497:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
8010749b:	83 e2 ef             	and    $0xffffffef,%edx
8010749e:	88 50 7e             	mov    %dl,0x7e(%eax)
801074a1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801074a4:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
801074a8:	83 e2 df             	and    $0xffffffdf,%edx
801074ab:	88 50 7e             	mov    %dl,0x7e(%eax)
801074ae:	8b 45 f4             	mov    -0xc(%ebp),%eax
801074b1:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
801074b5:	83 ca 40             	or     $0x40,%edx
801074b8:	88 50 7e             	mov    %dl,0x7e(%eax)
801074bb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801074be:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
801074c2:	83 ca 80             	or     $0xffffff80,%edx
801074c5:	88 50 7e             	mov    %dl,0x7e(%eax)
801074c8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801074cb:	c6 40 7f 00          	movb   $0x0,0x7f(%eax)
  c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
801074cf:	8b 45 f4             	mov    -0xc(%ebp),%eax
801074d2:	66 c7 80 80 00 00 00 	movw   $0xffff,0x80(%eax)
801074d9:	ff ff 
801074db:	8b 45 f4             	mov    -0xc(%ebp),%eax
801074de:	66 c7 80 82 00 00 00 	movw   $0x0,0x82(%eax)
801074e5:	00 00 
801074e7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801074ea:	c6 80 84 00 00 00 00 	movb   $0x0,0x84(%eax)
801074f1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801074f4:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
801074fb:	83 e2 f0             	and    $0xfffffff0,%edx
801074fe:	83 ca 02             	or     $0x2,%edx
80107501:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
80107507:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010750a:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
80107511:	83 ca 10             	or     $0x10,%edx
80107514:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
8010751a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010751d:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
80107524:	83 e2 9f             	and    $0xffffff9f,%edx
80107527:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
8010752d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107530:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
80107537:	83 ca 80             	or     $0xffffff80,%edx
8010753a:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
80107540:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107543:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
8010754a:	83 ca 0f             	or     $0xf,%edx
8010754d:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
80107553:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107556:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
8010755d:	83 e2 ef             	and    $0xffffffef,%edx
80107560:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
80107566:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107569:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80107570:	83 e2 df             	and    $0xffffffdf,%edx
80107573:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
80107579:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010757c:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80107583:	83 ca 40             	or     $0x40,%edx
80107586:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
8010758c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010758f:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80107596:	83 ca 80             	or     $0xffffff80,%edx
80107599:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
8010759f:	8b 45 f4             	mov    -0xc(%ebp),%eax
801075a2:	c6 80 87 00 00 00 00 	movb   $0x0,0x87(%eax)
  c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
801075a9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801075ac:	66 c7 80 90 00 00 00 	movw   $0xffff,0x90(%eax)
801075b3:	ff ff 
801075b5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801075b8:	66 c7 80 92 00 00 00 	movw   $0x0,0x92(%eax)
801075bf:	00 00 
801075c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801075c4:	c6 80 94 00 00 00 00 	movb   $0x0,0x94(%eax)
801075cb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801075ce:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
801075d5:	83 e2 f0             	and    $0xfffffff0,%edx
801075d8:	83 ca 0a             	or     $0xa,%edx
801075db:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
801075e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801075e4:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
801075eb:	83 ca 10             	or     $0x10,%edx
801075ee:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
801075f4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801075f7:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
801075fe:	83 ca 60             	or     $0x60,%edx
80107601:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
80107607:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010760a:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
80107611:	83 ca 80             	or     $0xffffff80,%edx
80107614:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
8010761a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010761d:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80107624:	83 ca 0f             	or     $0xf,%edx
80107627:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
8010762d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107630:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80107637:	83 e2 ef             	and    $0xffffffef,%edx
8010763a:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107640:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107643:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
8010764a:	83 e2 df             	and    $0xffffffdf,%edx
8010764d:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107653:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107656:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
8010765d:	83 ca 40             	or     $0x40,%edx
80107660:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107666:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107669:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80107670:	83 ca 80             	or     $0xffffff80,%edx
80107673:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107679:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010767c:	c6 80 97 00 00 00 00 	movb   $0x0,0x97(%eax)
  c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80107683:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107686:	66 c7 80 98 00 00 00 	movw   $0xffff,0x98(%eax)
8010768d:	ff ff 
8010768f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107692:	66 c7 80 9a 00 00 00 	movw   $0x0,0x9a(%eax)
80107699:	00 00 
8010769b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010769e:	c6 80 9c 00 00 00 00 	movb   $0x0,0x9c(%eax)
801076a5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801076a8:	0f b6 90 9d 00 00 00 	movzbl 0x9d(%eax),%edx
801076af:	83 e2 f0             	and    $0xfffffff0,%edx
801076b2:	83 ca 02             	or     $0x2,%edx
801076b5:	88 90 9d 00 00 00    	mov    %dl,0x9d(%eax)
801076bb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801076be:	0f b6 90 9d 00 00 00 	movzbl 0x9d(%eax),%edx
801076c5:	83 ca 10             	or     $0x10,%edx
801076c8:	88 90 9d 00 00 00    	mov    %dl,0x9d(%eax)
801076ce:	8b 45 f4             	mov    -0xc(%ebp),%eax
801076d1:	0f b6 90 9d 00 00 00 	movzbl 0x9d(%eax),%edx
801076d8:	83 ca 60             	or     $0x60,%edx
801076db:	88 90 9d 00 00 00    	mov    %dl,0x9d(%eax)
801076e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801076e4:	0f b6 90 9d 00 00 00 	movzbl 0x9d(%eax),%edx
801076eb:	83 ca 80             	or     $0xffffff80,%edx
801076ee:	88 90 9d 00 00 00    	mov    %dl,0x9d(%eax)
801076f4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801076f7:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
801076fe:	83 ca 0f             	or     $0xf,%edx
80107701:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
80107707:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010770a:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
80107711:	83 e2 ef             	and    $0xffffffef,%edx
80107714:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
8010771a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010771d:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
80107724:	83 e2 df             	and    $0xffffffdf,%edx
80107727:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
8010772d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107730:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
80107737:	83 ca 40             	or     $0x40,%edx
8010773a:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
80107740:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107743:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
8010774a:	83 ca 80             	or     $0xffffff80,%edx
8010774d:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
80107753:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107756:	c6 80 9f 00 00 00 00 	movb   $0x0,0x9f(%eax)

  // Map cpu, and curproc
  c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
8010775d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107760:	05 b4 00 00 00       	add    $0xb4,%eax
80107765:	89 c3                	mov    %eax,%ebx
80107767:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010776a:	05 b4 00 00 00       	add    $0xb4,%eax
8010776f:	c1 e8 10             	shr    $0x10,%eax
80107772:	89 c1                	mov    %eax,%ecx
80107774:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107777:	05 b4 00 00 00       	add    $0xb4,%eax
8010777c:	c1 e8 18             	shr    $0x18,%eax
8010777f:	89 c2                	mov    %eax,%edx
80107781:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107784:	66 c7 80 88 00 00 00 	movw   $0x0,0x88(%eax)
8010778b:	00 00 
8010778d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107790:	66 89 98 8a 00 00 00 	mov    %bx,0x8a(%eax)
80107797:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010779a:	88 88 8c 00 00 00    	mov    %cl,0x8c(%eax)
801077a0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801077a3:	0f b6 88 8d 00 00 00 	movzbl 0x8d(%eax),%ecx
801077aa:	83 e1 f0             	and    $0xfffffff0,%ecx
801077ad:	83 c9 02             	or     $0x2,%ecx
801077b0:	88 88 8d 00 00 00    	mov    %cl,0x8d(%eax)
801077b6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801077b9:	0f b6 88 8d 00 00 00 	movzbl 0x8d(%eax),%ecx
801077c0:	83 c9 10             	or     $0x10,%ecx
801077c3:	88 88 8d 00 00 00    	mov    %cl,0x8d(%eax)
801077c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801077cc:	0f b6 88 8d 00 00 00 	movzbl 0x8d(%eax),%ecx
801077d3:	83 e1 9f             	and    $0xffffff9f,%ecx
801077d6:	88 88 8d 00 00 00    	mov    %cl,0x8d(%eax)
801077dc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801077df:	0f b6 88 8d 00 00 00 	movzbl 0x8d(%eax),%ecx
801077e6:	83 c9 80             	or     $0xffffff80,%ecx
801077e9:	88 88 8d 00 00 00    	mov    %cl,0x8d(%eax)
801077ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
801077f2:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
801077f9:	83 e1 f0             	and    $0xfffffff0,%ecx
801077fc:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
80107802:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107805:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
8010780c:	83 e1 ef             	and    $0xffffffef,%ecx
8010780f:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
80107815:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107818:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
8010781f:	83 e1 df             	and    $0xffffffdf,%ecx
80107822:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
80107828:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010782b:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
80107832:	83 c9 40             	or     $0x40,%ecx
80107835:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
8010783b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010783e:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
80107845:	83 c9 80             	or     $0xffffff80,%ecx
80107848:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
8010784e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107851:	88 90 8f 00 00 00    	mov    %dl,0x8f(%eax)

  lgdt(c->gdt, sizeof(c->gdt));
80107857:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010785a:	83 c0 70             	add    $0x70,%eax
8010785d:	c7 44 24 04 38 00 00 	movl   $0x38,0x4(%esp)
80107864:	00 
80107865:	89 04 24             	mov    %eax,(%esp)
80107868:	e8 37 fb ff ff       	call   801073a4 <lgdt>
  loadgs(SEG_KCPU << 3);
8010786d:	c7 04 24 18 00 00 00 	movl   $0x18,(%esp)
80107874:	e8 6a fb ff ff       	call   801073e3 <loadgs>

  // Initialize cpu-local storage.
  cpu = c;
80107879:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010787c:	65 a3 00 00 00 00    	mov    %eax,%gs:0x0
  proc = 0;
80107882:	65 c7 05 04 00 00 00 	movl   $0x0,%gs:0x4
80107889:	00 00 00 00 

  kmap_dump();
8010788d:	e8 30 01 00 00       	call   801079c2 <kmap_dump>
}
80107892:	83 c4 24             	add    $0x24,%esp
80107895:	5b                   	pop    %ebx
80107896:	5d                   	pop    %ebp
80107897:	c3                   	ret    

80107898 <walkpgdir>:
// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va.  If alloc!=0,
// create any required page table pages.
static pte_t *
walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
80107898:	55                   	push   %ebp
80107899:	89 e5                	mov    %esp,%ebp
8010789b:	83 ec 28             	sub    $0x28,%esp
  pde_t *pde;
  pte_t *pgtab;

  pde = &pgdir[PDX(va)];
8010789e:	8b 45 0c             	mov    0xc(%ebp),%eax
801078a1:	c1 e8 16             	shr    $0x16,%eax
801078a4:	c1 e0 02             	shl    $0x2,%eax
801078a7:	03 45 08             	add    0x8(%ebp),%eax
801078aa:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(*pde & PTE_P){
801078ad:	8b 45 f0             	mov    -0x10(%ebp),%eax
801078b0:	8b 00                	mov    (%eax),%eax
801078b2:	83 e0 01             	and    $0x1,%eax
801078b5:	84 c0                	test   %al,%al
801078b7:	74 17                	je     801078d0 <walkpgdir+0x38>
    pgtab = (pte_t*)p2v(PTE_ADDR(*pde));
801078b9:	8b 45 f0             	mov    -0x10(%ebp),%eax
801078bc:	8b 00                	mov    (%eax),%eax
801078be:	25 00 f0 ff ff       	and    $0xfffff000,%eax
801078c3:	89 04 24             	mov    %eax,(%esp)
801078c6:	e8 45 fb ff ff       	call   80107410 <p2v>
801078cb:	89 45 f4             	mov    %eax,-0xc(%ebp)
801078ce:	eb 4b                	jmp    8010791b <walkpgdir+0x83>
  } else {
    if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
801078d0:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801078d4:	74 0e                	je     801078e4 <walkpgdir+0x4c>
801078d6:	e8 36 b3 ff ff       	call   80102c11 <kalloc>
801078db:	89 45 f4             	mov    %eax,-0xc(%ebp)
801078de:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801078e2:	75 07                	jne    801078eb <walkpgdir+0x53>
      return 0;
801078e4:	b8 00 00 00 00       	mov    $0x0,%eax
801078e9:	eb 41                	jmp    8010792c <walkpgdir+0x94>
    // Make sure all those PTE_P bits are zero.
    memset(pgtab, 0, PGSIZE);
801078eb:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
801078f2:	00 
801078f3:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801078fa:	00 
801078fb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801078fe:	89 04 24             	mov    %eax,(%esp)
80107901:	e8 94 d5 ff ff       	call   80104e9a <memset>
    // The permissions here are overly generous, but they can
    // be further restricted by the permissions in the page table
    // entries, if necessary.
    *pde = v2p(pgtab) | PTE_P | PTE_W | PTE_U;
80107906:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107909:	89 04 24             	mov    %eax,(%esp)
8010790c:	e8 f2 fa ff ff       	call   80107403 <v2p>
80107911:	89 c2                	mov    %eax,%edx
80107913:	83 ca 07             	or     $0x7,%edx
80107916:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107919:	89 10                	mov    %edx,(%eax)
  }
  return &pgtab[PTX(va)];
8010791b:	8b 45 0c             	mov    0xc(%ebp),%eax
8010791e:	c1 e8 0c             	shr    $0xc,%eax
80107921:	25 ff 03 00 00       	and    $0x3ff,%eax
80107926:	c1 e0 02             	shl    $0x2,%eax
80107929:	03 45 f4             	add    -0xc(%ebp),%eax
}
8010792c:	c9                   	leave  
8010792d:	c3                   	ret    

8010792e <mappages>:
// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
8010792e:	55                   	push   %ebp
8010792f:	89 e5                	mov    %esp,%ebp
80107931:	83 ec 28             	sub    $0x28,%esp
  char *a, *last;
  pte_t *pte;
  //printf(1, "[mappages]\tpgdir=%#010x\tva=%#010x\tpa=0x%x\tperm=0x%x\n",*pgdir,(char*)va,pa,perm);


  a = (char*)PGROUNDDOWN((uint)va);
80107934:	8b 45 0c             	mov    0xc(%ebp),%eax
80107937:	25 00 f0 ff ff       	and    $0xfffff000,%eax
8010793c:	89 45 f4             	mov    %eax,-0xc(%ebp)
  last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
8010793f:	8b 45 0c             	mov    0xc(%ebp),%eax
80107942:	03 45 10             	add    0x10(%ebp),%eax
80107945:	83 e8 01             	sub    $0x1,%eax
80107948:	25 00 f0 ff ff       	and    $0xfffff000,%eax
8010794d:	89 45 f0             	mov    %eax,-0x10(%ebp)
  for(;;){
    if((pte = walkpgdir(pgdir, a, 1)) == 0)
80107950:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
80107957:	00 
80107958:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010795b:	89 44 24 04          	mov    %eax,0x4(%esp)
8010795f:	8b 45 08             	mov    0x8(%ebp),%eax
80107962:	89 04 24             	mov    %eax,(%esp)
80107965:	e8 2e ff ff ff       	call   80107898 <walkpgdir>
8010796a:	89 45 ec             	mov    %eax,-0x14(%ebp)
8010796d:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80107971:	75 07                	jne    8010797a <mappages+0x4c>
      return -1;
80107973:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80107978:	eb 46                	jmp    801079c0 <mappages+0x92>
    if(*pte & PTE_P)
8010797a:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010797d:	8b 00                	mov    (%eax),%eax
8010797f:	83 e0 01             	and    $0x1,%eax
80107982:	84 c0                	test   %al,%al
80107984:	74 0c                	je     80107992 <mappages+0x64>
      panic("remap");
80107986:	c7 04 24 10 8f 10 80 	movl   $0x80108f10,(%esp)
8010798d:	e8 c3 8b ff ff       	call   80100555 <panic>
    *pte = pa | perm | PTE_P;
80107992:	8b 45 18             	mov    0x18(%ebp),%eax
80107995:	0b 45 14             	or     0x14(%ebp),%eax
80107998:	89 c2                	mov    %eax,%edx
8010799a:	83 ca 01             	or     $0x1,%edx
8010799d:	8b 45 ec             	mov    -0x14(%ebp),%eax
801079a0:	89 10                	mov    %edx,(%eax)
    if(a == last)
801079a2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801079a5:	3b 45 f0             	cmp    -0x10(%ebp),%eax
801079a8:	74 10                	je     801079ba <mappages+0x8c>
      break;
    a += PGSIZE;
801079aa:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
    pa += PGSIZE;
801079b1:	81 45 14 00 10 00 00 	addl   $0x1000,0x14(%ebp)
  }
801079b8:	eb 96                	jmp    80107950 <mappages+0x22>
      return -1;
    if(*pte & PTE_P)
      panic("remap");
    *pte = pa | perm | PTE_P;
    if(a == last)
      break;
801079ba:	90                   	nop
    pa += PGSIZE;
  }

  //cprintf("[mappages]\tpgdir=%x\tva=%x\tpa=%x\tperm=%x\n",pgdir,(char*)va,pa,perm);

  return 0;
801079bb:	b8 00 00 00 00       	mov    $0x0,%eax
}
801079c0:	c9                   	leave  
801079c1:	c3                   	ret    

801079c2 <kmap_dump>:
 { (void*)data,     V2P(data),     PHYSTOP,   PTE_W}, // kern data+memory
 { (void*)DEVSPACE, DEVSPACE,      0,         PTE_W}, // more devices
};

void kmap_dump()
{
801079c2:	55                   	push   %ebp
801079c3:	89 e5                	mov    %esp,%ebp
801079c5:	83 ec 18             	sub    $0x18,%esp
  cprintf("[kmap_dump]\t--------------------------- kmap dump ---------------------------\n");
801079c8:	c7 04 24 18 8f 10 80 	movl   $0x80108f18,(%esp)
801079cf:	e8 cd 89 ff ff       	call   801003a1 <cprintf>
  cprintf("[kmap_dump]\t- kmap[0]\tVA=%x\tstart=%x\tend=%x\t-\n",kmap[0].virt,kmap[0].phys_start,kmap[0].phys_end);
801079d4:	8b 0d a8 c4 10 80    	mov    0x8010c4a8,%ecx
801079da:	8b 15 a4 c4 10 80    	mov    0x8010c4a4,%edx
801079e0:	a1 a0 c4 10 80       	mov    0x8010c4a0,%eax
801079e5:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
801079e9:	89 54 24 08          	mov    %edx,0x8(%esp)
801079ed:	89 44 24 04          	mov    %eax,0x4(%esp)
801079f1:	c7 04 24 68 8f 10 80 	movl   $0x80108f68,(%esp)
801079f8:	e8 a4 89 ff ff       	call   801003a1 <cprintf>
  cprintf("[kmap_dump]\t- kmap[1]\tVA=%x\tstart=%x\tend=%x\t-\n",kmap[1].virt,kmap[1].phys_start,kmap[1].phys_end);
801079fd:	8b 0d b8 c4 10 80    	mov    0x8010c4b8,%ecx
80107a03:	8b 15 b4 c4 10 80    	mov    0x8010c4b4,%edx
80107a09:	a1 b0 c4 10 80       	mov    0x8010c4b0,%eax
80107a0e:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
80107a12:	89 54 24 08          	mov    %edx,0x8(%esp)
80107a16:	89 44 24 04          	mov    %eax,0x4(%esp)
80107a1a:	c7 04 24 98 8f 10 80 	movl   $0x80108f98,(%esp)
80107a21:	e8 7b 89 ff ff       	call   801003a1 <cprintf>
  cprintf("[kmap_dump]\t- kmap[2]\tVA=%x\tstart=%x\tend=%x\t-\n",kmap[2].virt,kmap[2].phys_start,kmap[2].phys_end);
80107a26:	8b 0d c8 c4 10 80    	mov    0x8010c4c8,%ecx
80107a2c:	8b 15 c4 c4 10 80    	mov    0x8010c4c4,%edx
80107a32:	a1 c0 c4 10 80       	mov    0x8010c4c0,%eax
80107a37:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
80107a3b:	89 54 24 08          	mov    %edx,0x8(%esp)
80107a3f:	89 44 24 04          	mov    %eax,0x4(%esp)
80107a43:	c7 04 24 c8 8f 10 80 	movl   $0x80108fc8,(%esp)
80107a4a:	e8 52 89 ff ff       	call   801003a1 <cprintf>
  cprintf("[kmap_dump]\t- kmap[3]\tVA=%x\tstart=%x\tend=%x\t-\n",kmap[3].virt,kmap[3].phys_start,kmap[3].phys_end);
80107a4f:	8b 0d d8 c4 10 80    	mov    0x8010c4d8,%ecx
80107a55:	8b 15 d4 c4 10 80    	mov    0x8010c4d4,%edx
80107a5b:	a1 d0 c4 10 80       	mov    0x8010c4d0,%eax
80107a60:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
80107a64:	89 54 24 08          	mov    %edx,0x8(%esp)
80107a68:	89 44 24 04          	mov    %eax,0x4(%esp)
80107a6c:	c7 04 24 f8 8f 10 80 	movl   $0x80108ff8,(%esp)
80107a73:	e8 29 89 ff ff       	call   801003a1 <cprintf>
  cprintf("[kmap_dump]\t--------------------------- kmap dump ---------------------------\n");
80107a78:	c7 04 24 18 8f 10 80 	movl   $0x80108f18,(%esp)
80107a7f:	e8 1d 89 ff ff       	call   801003a1 <cprintf>
}
80107a84:	c9                   	leave  
80107a85:	c3                   	ret    

80107a86 <setupkvm>:

// Set up kernel part of a page table.
pde_t*
setupkvm(void)
{
80107a86:	55                   	push   %ebp
80107a87:	89 e5                	mov    %esp,%ebp
80107a89:	53                   	push   %ebx
80107a8a:	83 ec 34             	sub    $0x34,%esp
  pde_t *pgdir;
  struct kmap *k;
  cprintf("[setupkvm]\t------\tstarting setupkvm\t------\n");
80107a8d:	c7 04 24 28 90 10 80 	movl   $0x80109028,(%esp)
80107a94:	e8 08 89 ff ff       	call   801003a1 <cprintf>
  if((pgdir = (pde_t*)kalloc()) == 0)
80107a99:	e8 73 b1 ff ff       	call   80102c11 <kalloc>
80107a9e:	89 45 f0             	mov    %eax,-0x10(%ebp)
80107aa1:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80107aa5:	75 0a                	jne    80107ab1 <setupkvm+0x2b>
    return 0;
80107aa7:	b8 00 00 00 00       	mov    $0x0,%eax
80107aac:	e9 b7 00 00 00       	jmp    80107b68 <setupkvm+0xe2>
  memset(pgdir, 0, PGSIZE);
80107ab1:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80107ab8:	00 
80107ab9:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80107ac0:	00 
80107ac1:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107ac4:	89 04 24             	mov    %eax,(%esp)
80107ac7:	e8 ce d3 ff ff       	call   80104e9a <memset>
  if (p2v(PHYSTOP) > (void*)DEVSPACE)
80107acc:	c7 04 24 00 00 00 0e 	movl   $0xe000000,(%esp)
80107ad3:	e8 38 f9 ff ff       	call   80107410 <p2v>
80107ad8:	3d 00 00 00 fe       	cmp    $0xfe000000,%eax
80107add:	76 0c                	jbe    80107aeb <setupkvm+0x65>
    panic("PHYSTOP too high");
80107adf:	c7 04 24 54 90 10 80 	movl   $0x80109054,(%esp)
80107ae6:	e8 6a 8a ff ff       	call   80100555 <panic>
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80107aeb:	c7 45 f4 a0 c4 10 80 	movl   $0x8010c4a0,-0xc(%ebp)
80107af2:	eb 49                	jmp    80107b3d <setupkvm+0xb7>
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
                (uint)k->phys_start, k->perm) < 0)
80107af4:	8b 45 f4             	mov    -0xc(%ebp),%eax
    return 0;
  memset(pgdir, 0, PGSIZE);
  if (p2v(PHYSTOP) > (void*)DEVSPACE)
    panic("PHYSTOP too high");
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
80107af7:	8b 48 0c             	mov    0xc(%eax),%ecx
                (uint)k->phys_start, k->perm) < 0)
80107afa:	8b 45 f4             	mov    -0xc(%ebp),%eax
    return 0;
  memset(pgdir, 0, PGSIZE);
  if (p2v(PHYSTOP) > (void*)DEVSPACE)
    panic("PHYSTOP too high");
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
80107afd:	8b 50 04             	mov    0x4(%eax),%edx
80107b00:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b03:	8b 58 08             	mov    0x8(%eax),%ebx
80107b06:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b09:	8b 40 04             	mov    0x4(%eax),%eax
80107b0c:	29 c3                	sub    %eax,%ebx
80107b0e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b11:	8b 00                	mov    (%eax),%eax
80107b13:	89 4c 24 10          	mov    %ecx,0x10(%esp)
80107b17:	89 54 24 0c          	mov    %edx,0xc(%esp)
80107b1b:	89 5c 24 08          	mov    %ebx,0x8(%esp)
80107b1f:	89 44 24 04          	mov    %eax,0x4(%esp)
80107b23:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107b26:	89 04 24             	mov    %eax,(%esp)
80107b29:	e8 00 fe ff ff       	call   8010792e <mappages>
80107b2e:	85 c0                	test   %eax,%eax
80107b30:	79 07                	jns    80107b39 <setupkvm+0xb3>
                (uint)k->phys_start, k->perm) < 0)
      return 0;
80107b32:	b8 00 00 00 00       	mov    $0x0,%eax
80107b37:	eb 2f                	jmp    80107b68 <setupkvm+0xe2>
  if((pgdir = (pde_t*)kalloc()) == 0)
    return 0;
  memset(pgdir, 0, PGSIZE);
  if (p2v(PHYSTOP) > (void*)DEVSPACE)
    panic("PHYSTOP too high");
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80107b39:	83 45 f4 10          	addl   $0x10,-0xc(%ebp)
80107b3d:	81 7d f4 e0 c4 10 80 	cmpl   $0x8010c4e0,-0xc(%ebp)
80107b44:	72 ae                	jb     80107af4 <setupkvm+0x6e>
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
                (uint)k->phys_start, k->perm) < 0)
      return 0;


  cprintf("[setupkvm]\tpgdir=%x\n",pgdir);
80107b46:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107b49:	89 44 24 04          	mov    %eax,0x4(%esp)
80107b4d:	c7 04 24 65 90 10 80 	movl   $0x80109065,(%esp)
80107b54:	e8 48 88 ff ff       	call   801003a1 <cprintf>
  cprintf("[setupkvm]\t------\tending setupkvm\t------\n\n");
80107b59:	c7 04 24 7c 90 10 80 	movl   $0x8010907c,(%esp)
80107b60:	e8 3c 88 ff ff       	call   801003a1 <cprintf>
  return pgdir;
80107b65:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
80107b68:	83 c4 34             	add    $0x34,%esp
80107b6b:	5b                   	pop    %ebx
80107b6c:	5d                   	pop    %ebp
80107b6d:	c3                   	ret    

80107b6e <kvmalloc>:

// Allocate one page table for the machine for the kernel address
// space for scheduler processes.
void
kvmalloc(void)
{
80107b6e:	55                   	push   %ebp
80107b6f:	89 e5                	mov    %esp,%ebp
80107b71:	83 ec 08             	sub    $0x8,%esp
  kpgdir = setupkvm();
80107b74:	e8 0d ff ff ff       	call   80107a86 <setupkvm>
80107b79:	a3 18 37 11 80       	mov    %eax,0x80113718

  switchkvm();
80107b7e:	e8 02 00 00 00       	call   80107b85 <switchkvm>
}
80107b83:	c9                   	leave  
80107b84:	c3                   	ret    

80107b85 <switchkvm>:

// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
80107b85:	55                   	push   %ebp
80107b86:	89 e5                	mov    %esp,%ebp
80107b88:	83 ec 04             	sub    $0x4,%esp
  lcr3(v2p(kpgdir));   // switch to the kernel page table
80107b8b:	a1 18 37 11 80       	mov    0x80113718,%eax
80107b90:	89 04 24             	mov    %eax,(%esp)
80107b93:	e8 6b f8 ff ff       	call   80107403 <v2p>
80107b98:	89 04 24             	mov    %eax,(%esp)
80107b9b:	e8 58 f8 ff ff       	call   801073f8 <lcr3>
}
80107ba0:	c9                   	leave  
80107ba1:	c3                   	ret    

80107ba2 <switchuvm>:

// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
80107ba2:	55                   	push   %ebp
80107ba3:	89 e5                	mov    %esp,%ebp
80107ba5:	53                   	push   %ebx
80107ba6:	83 ec 14             	sub    $0x14,%esp
  pushcli();
80107ba9:	e8 e5 d1 ff ff       	call   80104d93 <pushcli>
  cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
80107bae:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80107bb4:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
80107bbb:	83 c2 08             	add    $0x8,%edx
80107bbe:	89 d3                	mov    %edx,%ebx
80107bc0:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
80107bc7:	83 c2 08             	add    $0x8,%edx
80107bca:	c1 ea 10             	shr    $0x10,%edx
80107bcd:	89 d1                	mov    %edx,%ecx
80107bcf:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
80107bd6:	83 c2 08             	add    $0x8,%edx
80107bd9:	c1 ea 18             	shr    $0x18,%edx
80107bdc:	66 c7 80 a0 00 00 00 	movw   $0x67,0xa0(%eax)
80107be3:	67 00 
80107be5:	66 89 98 a2 00 00 00 	mov    %bx,0xa2(%eax)
80107bec:	88 88 a4 00 00 00    	mov    %cl,0xa4(%eax)
80107bf2:	0f b6 88 a5 00 00 00 	movzbl 0xa5(%eax),%ecx
80107bf9:	83 e1 f0             	and    $0xfffffff0,%ecx
80107bfc:	83 c9 09             	or     $0x9,%ecx
80107bff:	88 88 a5 00 00 00    	mov    %cl,0xa5(%eax)
80107c05:	0f b6 88 a5 00 00 00 	movzbl 0xa5(%eax),%ecx
80107c0c:	83 c9 10             	or     $0x10,%ecx
80107c0f:	88 88 a5 00 00 00    	mov    %cl,0xa5(%eax)
80107c15:	0f b6 88 a5 00 00 00 	movzbl 0xa5(%eax),%ecx
80107c1c:	83 e1 9f             	and    $0xffffff9f,%ecx
80107c1f:	88 88 a5 00 00 00    	mov    %cl,0xa5(%eax)
80107c25:	0f b6 88 a5 00 00 00 	movzbl 0xa5(%eax),%ecx
80107c2c:	83 c9 80             	or     $0xffffff80,%ecx
80107c2f:	88 88 a5 00 00 00    	mov    %cl,0xa5(%eax)
80107c35:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
80107c3c:	83 e1 f0             	and    $0xfffffff0,%ecx
80107c3f:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80107c45:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
80107c4c:	83 e1 ef             	and    $0xffffffef,%ecx
80107c4f:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80107c55:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
80107c5c:	83 e1 df             	and    $0xffffffdf,%ecx
80107c5f:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80107c65:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
80107c6c:	83 c9 40             	or     $0x40,%ecx
80107c6f:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80107c75:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
80107c7c:	83 e1 7f             	and    $0x7f,%ecx
80107c7f:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80107c85:	88 90 a7 00 00 00    	mov    %dl,0xa7(%eax)
  cpu->gdt[SEG_TSS].s = 0;
80107c8b:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80107c91:	0f b6 90 a5 00 00 00 	movzbl 0xa5(%eax),%edx
80107c98:	83 e2 ef             	and    $0xffffffef,%edx
80107c9b:	88 90 a5 00 00 00    	mov    %dl,0xa5(%eax)
  cpu->ts.ss0 = SEG_KDATA << 3;
80107ca1:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80107ca7:	66 c7 40 10 10 00    	movw   $0x10,0x10(%eax)
  cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE;
80107cad:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80107cb3:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
80107cba:	8b 52 08             	mov    0x8(%edx),%edx
80107cbd:	81 c2 00 10 00 00    	add    $0x1000,%edx
80107cc3:	89 50 0c             	mov    %edx,0xc(%eax)
  ltr(SEG_TSS << 3);
80107cc6:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
80107ccd:	e8 fb f6 ff ff       	call   801073cd <ltr>
  if(p->pgdir == 0)
80107cd2:	8b 45 08             	mov    0x8(%ebp),%eax
80107cd5:	8b 40 04             	mov    0x4(%eax),%eax
80107cd8:	85 c0                	test   %eax,%eax
80107cda:	75 0c                	jne    80107ce8 <switchuvm+0x146>
    panic("switchuvm: no pgdir");
80107cdc:	c7 04 24 a7 90 10 80 	movl   $0x801090a7,(%esp)
80107ce3:	e8 6d 88 ff ff       	call   80100555 <panic>
  lcr3(v2p(p->pgdir));  // switch to new address space
80107ce8:	8b 45 08             	mov    0x8(%ebp),%eax
80107ceb:	8b 40 04             	mov    0x4(%eax),%eax
80107cee:	89 04 24             	mov    %eax,(%esp)
80107cf1:	e8 0d f7 ff ff       	call   80107403 <v2p>
80107cf6:	89 04 24             	mov    %eax,(%esp)
80107cf9:	e8 fa f6 ff ff       	call   801073f8 <lcr3>
  popcli();
80107cfe:	e8 d8 d0 ff ff       	call   80104ddb <popcli>
}
80107d03:	83 c4 14             	add    $0x14,%esp
80107d06:	5b                   	pop    %ebx
80107d07:	5d                   	pop    %ebp
80107d08:	c3                   	ret    

80107d09 <inituvm>:

// Load the initcode into address 0 of pgdir.
// sz must be less than a page.
void
inituvm(pde_t *pgdir, char *init, uint sz)
{
80107d09:	55                   	push   %ebp
80107d0a:	89 e5                	mov    %esp,%ebp
80107d0c:	83 ec 38             	sub    $0x38,%esp
  //uint i,j;
  // uint *pde, *pgtab, *pte, pa;
  // uint va, *p_pa;
  // char *v;

  if(sz >= PGSIZE)
80107d0f:	81 7d 10 ff 0f 00 00 	cmpl   $0xfff,0x10(%ebp)
80107d16:	76 0c                	jbe    80107d24 <inituvm+0x1b>
    panic("inituvm: more than a page");
80107d18:	c7 04 24 bb 90 10 80 	movl   $0x801090bb,(%esp)
80107d1f:	e8 31 88 ff ff       	call   80100555 <panic>
  mem = kalloc();
80107d24:	e8 e8 ae ff ff       	call   80102c11 <kalloc>
80107d29:	89 45 f4             	mov    %eax,-0xc(%ebp)
  memset(mem, 0, PGSIZE);
80107d2c:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80107d33:	00 
80107d34:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80107d3b:	00 
80107d3c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107d3f:	89 04 24             	mov    %eax,(%esp)
80107d42:	e8 53 d1 ff ff       	call   80104e9a <memset>
  mappages(pgdir, 0, PGSIZE, v2p(mem), PTE_W|PTE_U);
80107d47:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107d4a:	89 04 24             	mov    %eax,(%esp)
80107d4d:	e8 b1 f6 ff ff       	call   80107403 <v2p>
80107d52:	c7 44 24 10 06 00 00 	movl   $0x6,0x10(%esp)
80107d59:	00 
80107d5a:	89 44 24 0c          	mov    %eax,0xc(%esp)
80107d5e:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80107d65:	00 
80107d66:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80107d6d:	00 
80107d6e:	8b 45 08             	mov    0x8(%ebp),%eax
80107d71:	89 04 24             	mov    %eax,(%esp)
80107d74:	e8 b5 fb ff ff       	call   8010792e <mappages>


 // for(i=0;i<1000*1000*10;i++)
 //   for(j=0;j<1000 *2;j++) {}

  memmove(mem, init, sz);
80107d79:	8b 45 10             	mov    0x10(%ebp),%eax
80107d7c:	89 44 24 08          	mov    %eax,0x8(%esp)
80107d80:	8b 45 0c             	mov    0xc(%ebp),%eax
80107d83:	89 44 24 04          	mov    %eax,0x4(%esp)
80107d87:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107d8a:	89 04 24             	mov    %eax,(%esp)
80107d8d:	e8 db d1 ff ff       	call   80104f6d <memmove>


}
80107d92:	c9                   	leave  
80107d93:	c3                   	ret    

80107d94 <loaduvm>:

// Load a program segment into pgdir.  addr must be page-aligned
// and the pages from addr to addr+sz must already be mapped.
int
loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz)
{
80107d94:	55                   	push   %ebp
80107d95:	89 e5                	mov    %esp,%ebp
80107d97:	53                   	push   %ebx
80107d98:	83 ec 24             	sub    $0x24,%esp
  uint i, pa, n;
  pte_t *pte;

  if((uint) addr % PGSIZE != 0)
80107d9b:	8b 45 0c             	mov    0xc(%ebp),%eax
80107d9e:	25 ff 0f 00 00       	and    $0xfff,%eax
80107da3:	85 c0                	test   %eax,%eax
80107da5:	74 0c                	je     80107db3 <loaduvm+0x1f>
    panic("loaduvm: addr must be page aligned");
80107da7:	c7 04 24 d8 90 10 80 	movl   $0x801090d8,(%esp)
80107dae:	e8 a2 87 ff ff       	call   80100555 <panic>
  for(i = 0; i < sz; i += PGSIZE){
80107db3:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80107dba:	e9 ad 00 00 00       	jmp    80107e6c <loaduvm+0xd8>
    if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
80107dbf:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107dc2:	8b 55 0c             	mov    0xc(%ebp),%edx
80107dc5:	01 d0                	add    %edx,%eax
80107dc7:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80107dce:	00 
80107dcf:	89 44 24 04          	mov    %eax,0x4(%esp)
80107dd3:	8b 45 08             	mov    0x8(%ebp),%eax
80107dd6:	89 04 24             	mov    %eax,(%esp)
80107dd9:	e8 ba fa ff ff       	call   80107898 <walkpgdir>
80107dde:	89 45 ec             	mov    %eax,-0x14(%ebp)
80107de1:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80107de5:	75 0c                	jne    80107df3 <loaduvm+0x5f>
      panic("loaduvm: address should exist");
80107de7:	c7 04 24 fb 90 10 80 	movl   $0x801090fb,(%esp)
80107dee:	e8 62 87 ff ff       	call   80100555 <panic>
    pa = PTE_ADDR(*pte);
80107df3:	8b 45 ec             	mov    -0x14(%ebp),%eax
80107df6:	8b 00                	mov    (%eax),%eax
80107df8:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80107dfd:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if(sz - i < PGSIZE)
80107e00:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107e03:	8b 55 18             	mov    0x18(%ebp),%edx
80107e06:	89 d1                	mov    %edx,%ecx
80107e08:	29 c1                	sub    %eax,%ecx
80107e0a:	89 c8                	mov    %ecx,%eax
80107e0c:	3d ff 0f 00 00       	cmp    $0xfff,%eax
80107e11:	77 11                	ja     80107e24 <loaduvm+0x90>
      n = sz - i;
80107e13:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107e16:	8b 55 18             	mov    0x18(%ebp),%edx
80107e19:	89 d1                	mov    %edx,%ecx
80107e1b:	29 c1                	sub    %eax,%ecx
80107e1d:	89 c8                	mov    %ecx,%eax
80107e1f:	89 45 f0             	mov    %eax,-0x10(%ebp)
80107e22:	eb 07                	jmp    80107e2b <loaduvm+0x97>
    else
      n = PGSIZE;
80107e24:	c7 45 f0 00 10 00 00 	movl   $0x1000,-0x10(%ebp)
    if(readi(ip, p2v(pa), offset+i, n) != n)
80107e2b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107e2e:	8b 55 14             	mov    0x14(%ebp),%edx
80107e31:	8d 1c 02             	lea    (%edx,%eax,1),%ebx
80107e34:	8b 45 e8             	mov    -0x18(%ebp),%eax
80107e37:	89 04 24             	mov    %eax,(%esp)
80107e3a:	e8 d1 f5 ff ff       	call   80107410 <p2v>
80107e3f:	8b 55 f0             	mov    -0x10(%ebp),%edx
80107e42:	89 54 24 0c          	mov    %edx,0xc(%esp)
80107e46:	89 5c 24 08          	mov    %ebx,0x8(%esp)
80107e4a:	89 44 24 04          	mov    %eax,0x4(%esp)
80107e4e:	8b 45 10             	mov    0x10(%ebp),%eax
80107e51:	89 04 24             	mov    %eax,(%esp)
80107e54:	e8 15 9f ff ff       	call   80101d6e <readi>
80107e59:	3b 45 f0             	cmp    -0x10(%ebp),%eax
80107e5c:	74 07                	je     80107e65 <loaduvm+0xd1>
      return -1;
80107e5e:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80107e63:	eb 18                	jmp    80107e7d <loaduvm+0xe9>
  uint i, pa, n;
  pte_t *pte;

  if((uint) addr % PGSIZE != 0)
    panic("loaduvm: addr must be page aligned");
  for(i = 0; i < sz; i += PGSIZE){
80107e65:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
80107e6c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107e6f:	3b 45 18             	cmp    0x18(%ebp),%eax
80107e72:	0f 82 47 ff ff ff    	jb     80107dbf <loaduvm+0x2b>
    else
      n = PGSIZE;
    if(readi(ip, p2v(pa), offset+i, n) != n)
      return -1;
  }
  return 0;
80107e78:	b8 00 00 00 00       	mov    $0x0,%eax
}
80107e7d:	83 c4 24             	add    $0x24,%esp
80107e80:	5b                   	pop    %ebx
80107e81:	5d                   	pop    %ebp
80107e82:	c3                   	ret    

80107e83 <allocuvm>:

// Allocate page tables and physical memory to grow process from oldsz to
// newsz, which need not be page aligned.  Returns new size or 0 on error.
int
allocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
80107e83:	55                   	push   %ebp
80107e84:	89 e5                	mov    %esp,%ebp
80107e86:	83 ec 38             	sub    $0x38,%esp
  char *mem;
  uint a;

  if(newsz >= KERNBASE)
80107e89:	8b 45 10             	mov    0x10(%ebp),%eax
80107e8c:	85 c0                	test   %eax,%eax
80107e8e:	79 0a                	jns    80107e9a <allocuvm+0x17>
    return 0;
80107e90:	b8 00 00 00 00       	mov    $0x0,%eax
80107e95:	e9 c1 00 00 00       	jmp    80107f5b <allocuvm+0xd8>
  if(newsz < oldsz)
80107e9a:	8b 45 10             	mov    0x10(%ebp),%eax
80107e9d:	3b 45 0c             	cmp    0xc(%ebp),%eax
80107ea0:	73 08                	jae    80107eaa <allocuvm+0x27>
    return oldsz;
80107ea2:	8b 45 0c             	mov    0xc(%ebp),%eax
80107ea5:	e9 b1 00 00 00       	jmp    80107f5b <allocuvm+0xd8>

  a = PGROUNDUP(oldsz);
80107eaa:	8b 45 0c             	mov    0xc(%ebp),%eax
80107ead:	05 ff 0f 00 00       	add    $0xfff,%eax
80107eb2:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80107eb7:	89 45 f4             	mov    %eax,-0xc(%ebp)
  for(; a < newsz; a += PGSIZE){
80107eba:	e9 8d 00 00 00       	jmp    80107f4c <allocuvm+0xc9>
    mem = kalloc();
80107ebf:	e8 4d ad ff ff       	call   80102c11 <kalloc>
80107ec4:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(mem == 0){
80107ec7:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80107ecb:	75 2c                	jne    80107ef9 <allocuvm+0x76>
      cprintf("allocuvm out of memory\n");
80107ecd:	c7 04 24 19 91 10 80 	movl   $0x80109119,(%esp)
80107ed4:	e8 c8 84 ff ff       	call   801003a1 <cprintf>
      deallocuvm(pgdir, newsz, oldsz);
80107ed9:	8b 45 0c             	mov    0xc(%ebp),%eax
80107edc:	89 44 24 08          	mov    %eax,0x8(%esp)
80107ee0:	8b 45 10             	mov    0x10(%ebp),%eax
80107ee3:	89 44 24 04          	mov    %eax,0x4(%esp)
80107ee7:	8b 45 08             	mov    0x8(%ebp),%eax
80107eea:	89 04 24             	mov    %eax,(%esp)
80107eed:	e8 6b 00 00 00       	call   80107f5d <deallocuvm>
      return 0;
80107ef2:	b8 00 00 00 00       	mov    $0x0,%eax
80107ef7:	eb 62                	jmp    80107f5b <allocuvm+0xd8>
    }
    memset(mem, 0, PGSIZE);
80107ef9:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80107f00:	00 
80107f01:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80107f08:	00 
80107f09:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107f0c:	89 04 24             	mov    %eax,(%esp)
80107f0f:	e8 86 cf ff ff       	call   80104e9a <memset>
    mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
80107f14:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107f17:	89 04 24             	mov    %eax,(%esp)
80107f1a:	e8 e4 f4 ff ff       	call   80107403 <v2p>
80107f1f:	8b 55 f4             	mov    -0xc(%ebp),%edx
80107f22:	c7 44 24 10 06 00 00 	movl   $0x6,0x10(%esp)
80107f29:	00 
80107f2a:	89 44 24 0c          	mov    %eax,0xc(%esp)
80107f2e:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80107f35:	00 
80107f36:	89 54 24 04          	mov    %edx,0x4(%esp)
80107f3a:	8b 45 08             	mov    0x8(%ebp),%eax
80107f3d:	89 04 24             	mov    %eax,(%esp)
80107f40:	e8 e9 f9 ff ff       	call   8010792e <mappages>
    return 0;
  if(newsz < oldsz)
    return oldsz;

  a = PGROUNDUP(oldsz);
  for(; a < newsz; a += PGSIZE){
80107f45:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
80107f4c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107f4f:	3b 45 10             	cmp    0x10(%ebp),%eax
80107f52:	0f 82 67 ff ff ff    	jb     80107ebf <allocuvm+0x3c>
    memset(mem, 0, PGSIZE);
    mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
  }
  //kmem_show("allocuvm");
  //cprintf("[allocuvm] newsz = %d\n", newsz, pgdir);
  return newsz;
80107f58:	8b 45 10             	mov    0x10(%ebp),%eax
}
80107f5b:	c9                   	leave  
80107f5c:	c3                   	ret    

80107f5d <deallocuvm>:
// newsz.  oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz.  oldsz can be larger than the actual
// process size.  Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
80107f5d:	55                   	push   %ebp
80107f5e:	89 e5                	mov    %esp,%ebp
80107f60:	83 ec 28             	sub    $0x28,%esp
  pte_t *pte;
  uint a, pa;

  if(newsz >= oldsz)
80107f63:	8b 45 10             	mov    0x10(%ebp),%eax
80107f66:	3b 45 0c             	cmp    0xc(%ebp),%eax
80107f69:	72 08                	jb     80107f73 <deallocuvm+0x16>
    return oldsz;
80107f6b:	8b 45 0c             	mov    0xc(%ebp),%eax
80107f6e:	e9 a4 00 00 00       	jmp    80108017 <deallocuvm+0xba>

  a = PGROUNDUP(newsz);
80107f73:	8b 45 10             	mov    0x10(%ebp),%eax
80107f76:	05 ff 0f 00 00       	add    $0xfff,%eax
80107f7b:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80107f80:	89 45 f4             	mov    %eax,-0xc(%ebp)
  for(; a  < oldsz; a += PGSIZE){
80107f83:	e9 80 00 00 00       	jmp    80108008 <deallocuvm+0xab>
    pte = walkpgdir(pgdir, (char*)a, 0);
80107f88:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107f8b:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80107f92:	00 
80107f93:	89 44 24 04          	mov    %eax,0x4(%esp)
80107f97:	8b 45 08             	mov    0x8(%ebp),%eax
80107f9a:	89 04 24             	mov    %eax,(%esp)
80107f9d:	e8 f6 f8 ff ff       	call   80107898 <walkpgdir>
80107fa2:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(!pte)
80107fa5:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80107fa9:	75 09                	jne    80107fb4 <deallocuvm+0x57>
      a += (NPTENTRIES - 1) * PGSIZE;
80107fab:	81 45 f4 00 f0 3f 00 	addl   $0x3ff000,-0xc(%ebp)
80107fb2:	eb 4d                	jmp    80108001 <deallocuvm+0xa4>
    else if((*pte & PTE_P) != 0){
80107fb4:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107fb7:	8b 00                	mov    (%eax),%eax
80107fb9:	83 e0 01             	and    $0x1,%eax
80107fbc:	84 c0                	test   %al,%al
80107fbe:	74 41                	je     80108001 <deallocuvm+0xa4>
      pa = PTE_ADDR(*pte);
80107fc0:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107fc3:	8b 00                	mov    (%eax),%eax
80107fc5:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80107fca:	89 45 ec             	mov    %eax,-0x14(%ebp)
      if(pa == 0)
80107fcd:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80107fd1:	75 0c                	jne    80107fdf <deallocuvm+0x82>
        panic("kfree");
80107fd3:	c7 04 24 31 91 10 80 	movl   $0x80109131,(%esp)
80107fda:	e8 76 85 ff ff       	call   80100555 <panic>
      char *v = p2v(pa);
80107fdf:	8b 45 ec             	mov    -0x14(%ebp),%eax
80107fe2:	89 04 24             	mov    %eax,(%esp)
80107fe5:	e8 26 f4 ff ff       	call   80107410 <p2v>
80107fea:	89 45 e8             	mov    %eax,-0x18(%ebp)
      kfree(v);
80107fed:	8b 45 e8             	mov    -0x18(%ebp),%eax
80107ff0:	89 04 24             	mov    %eax,(%esp)
80107ff3:	e8 80 ab ff ff       	call   80102b78 <kfree>
      *pte = 0;
80107ff8:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107ffb:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

  if(newsz >= oldsz)
    return oldsz;

  a = PGROUNDUP(newsz);
  for(; a  < oldsz; a += PGSIZE){
80108001:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
80108008:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010800b:	3b 45 0c             	cmp    0xc(%ebp),%eax
8010800e:	0f 82 74 ff ff ff    	jb     80107f88 <deallocuvm+0x2b>
      char *v = p2v(pa);
      kfree(v);
      *pte = 0;
    }
  }
  return newsz;
80108014:	8b 45 10             	mov    0x10(%ebp),%eax
}
80108017:	c9                   	leave  
80108018:	c3                   	ret    

80108019 <freevm>:

// Free a page table and all the physical memory pages
// in the user part.
void
freevm(pde_t *pgdir)
{
80108019:	55                   	push   %ebp
8010801a:	89 e5                	mov    %esp,%ebp
8010801c:	83 ec 28             	sub    $0x28,%esp
  uint i;
  uint used_count = 0;
8010801f:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)

  if(pgdir == 0)
80108026:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010802a:	75 0c                	jne    80108038 <freevm+0x1f>
    panic("freevm: no pgdir");
8010802c:	c7 04 24 37 91 10 80 	movl   $0x80109137,(%esp)
80108033:	e8 1d 85 ff ff       	call   80100555 <panic>

  deallocuvm(pgdir, KERNBASE, 0);
80108038:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
8010803f:	00 
80108040:	c7 44 24 04 00 00 00 	movl   $0x80000000,0x4(%esp)
80108047:	80 
80108048:	8b 45 08             	mov    0x8(%ebp),%eax
8010804b:	89 04 24             	mov    %eax,(%esp)
8010804e:	e8 0a ff ff ff       	call   80107f5d <deallocuvm>

  for(i = 0; i < NPDENTRIES; i++){
80108053:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010805a:	eb 40                	jmp    8010809c <freevm+0x83>
    if(pgdir[i] & PTE_P){
8010805c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010805f:	c1 e0 02             	shl    $0x2,%eax
80108062:	03 45 08             	add    0x8(%ebp),%eax
80108065:	8b 00                	mov    (%eax),%eax
80108067:	83 e0 01             	and    $0x1,%eax
8010806a:	84 c0                	test   %al,%al
8010806c:	74 2a                	je     80108098 <freevm+0x7f>
      char * v = p2v(PTE_ADDR(pgdir[i]));
8010806e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108071:	c1 e0 02             	shl    $0x2,%eax
80108074:	03 45 08             	add    0x8(%ebp),%eax
80108077:	8b 00                	mov    (%eax),%eax
80108079:	25 00 f0 ff ff       	and    $0xfffff000,%eax
8010807e:	89 04 24             	mov    %eax,(%esp)
80108081:	e8 8a f3 ff ff       	call   80107410 <p2v>
80108086:	89 45 ec             	mov    %eax,-0x14(%ebp)
      //cprintf("[freevm]\tpgdir[i]=%x\tVA=%p\n",*(pgdir+i),v);
      kfree(v);
80108089:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010808c:	89 04 24             	mov    %eax,(%esp)
8010808f:	e8 e4 aa ff ff       	call   80102b78 <kfree>
      used_count ++;
80108094:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
  if(pgdir == 0)
    panic("freevm: no pgdir");

  deallocuvm(pgdir, KERNBASE, 0);

  for(i = 0; i < NPDENTRIES; i++){
80108098:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010809c:	81 7d f4 ff 03 00 00 	cmpl   $0x3ff,-0xc(%ebp)
801080a3:	76 b7                	jbe    8010805c <freevm+0x43>
      //cprintf("[freevm]\tpgdir[i]=%x\tVA=%p\n",*(pgdir+i),v);
      kfree(v);
      used_count ++;
    }
  }
  kfree((char*)pgdir);
801080a5:	8b 45 08             	mov    0x8(%ebp),%eax
801080a8:	89 04 24             	mov    %eax,(%esp)
801080ab:	e8 c8 aa ff ff       	call   80102b78 <kfree>

  cprintf("[freevm]\tpgdir=%x\tpde_used=%d\n",*pgdir, used_count);
801080b0:	8b 45 08             	mov    0x8(%ebp),%eax
801080b3:	8b 00                	mov    (%eax),%eax
801080b5:	8b 55 f0             	mov    -0x10(%ebp),%edx
801080b8:	89 54 24 08          	mov    %edx,0x8(%esp)
801080bc:	89 44 24 04          	mov    %eax,0x4(%esp)
801080c0:	c7 04 24 48 91 10 80 	movl   $0x80109148,(%esp)
801080c7:	e8 d5 82 ff ff       	call   801003a1 <cprintf>
  //kmem_show("freevm");
}
801080cc:	c9                   	leave  
801080cd:	c3                   	ret    

801080ce <clearpteu>:
// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
// call in exec.c line 57
void
clearpteu(pde_t *pgdir, char *uva)
{
801080ce:	55                   	push   %ebp
801080cf:	89 e5                	mov    %esp,%ebp
801080d1:	83 ec 28             	sub    $0x28,%esp
  pte_t *pte;
  pte = walkpgdir(pgdir, uva, 0);
801080d4:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
801080db:	00 
801080dc:	8b 45 0c             	mov    0xc(%ebp),%eax
801080df:	89 44 24 04          	mov    %eax,0x4(%esp)
801080e3:	8b 45 08             	mov    0x8(%ebp),%eax
801080e6:	89 04 24             	mov    %eax,(%esp)
801080e9:	e8 aa f7 ff ff       	call   80107898 <walkpgdir>
801080ee:	89 45 f4             	mov    %eax,-0xc(%ebp)

  //cprintf("[clearpteu]\tpgdir = %p\tuva = %d\tpte = %p\n", pgdir, uva, *pte);

  if(pte == 0)
801080f1:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801080f5:	75 0c                	jne    80108103 <clearpteu+0x35>
    panic("clearpteu");
801080f7:	c7 04 24 67 91 10 80 	movl   $0x80109167,(%esp)
801080fe:	e8 52 84 ff ff       	call   80100555 <panic>

  *pte &= ~PTE_U;
80108103:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108106:	8b 00                	mov    (%eax),%eax
80108108:	89 c2                	mov    %eax,%edx
8010810a:	83 e2 fb             	and    $0xfffffffb,%edx
8010810d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108110:	89 10                	mov    %edx,(%eax)
}
80108112:	c9                   	leave  
80108113:	c3                   	ret    

80108114 <copyuvm>:

// Given a parent process's page table, create a copy
// of it for a child.
pde_t*
copyuvm(pde_t *pgdir, uint sz)
{
80108114:	55                   	push   %ebp
80108115:	89 e5                	mov    %esp,%ebp
80108117:	83 ec 48             	sub    $0x48,%esp
  pde_t *d;
  pte_t *pte;
  uint pa, i;
  char *mem;

  if((d = setupkvm()) == 0)
8010811a:	e8 67 f9 ff ff       	call   80107a86 <setupkvm>
8010811f:	89 45 f0             	mov    %eax,-0x10(%ebp)
80108122:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80108126:	75 0a                	jne    80108132 <copyuvm+0x1e>
    return 0;
80108128:	b8 00 00 00 00       	mov    $0x0,%eax
8010812d:	e9 f1 00 00 00       	jmp    80108223 <copyuvm+0x10f>
  for(i = 0; i < sz; i += PGSIZE){
80108132:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80108139:	e9 c0 00 00 00       	jmp    801081fe <copyuvm+0xea>
    if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
8010813e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108141:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80108148:	00 
80108149:	89 44 24 04          	mov    %eax,0x4(%esp)
8010814d:	8b 45 08             	mov    0x8(%ebp),%eax
80108150:	89 04 24             	mov    %eax,(%esp)
80108153:	e8 40 f7 ff ff       	call   80107898 <walkpgdir>
80108158:	89 45 ec             	mov    %eax,-0x14(%ebp)
8010815b:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
8010815f:	75 0c                	jne    8010816d <copyuvm+0x59>
      panic("copyuvm: pte should exist");
80108161:	c7 04 24 71 91 10 80 	movl   $0x80109171,(%esp)
80108168:	e8 e8 83 ff ff       	call   80100555 <panic>
    if(!(*pte & PTE_P))
8010816d:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108170:	8b 00                	mov    (%eax),%eax
80108172:	83 e0 01             	and    $0x1,%eax
80108175:	85 c0                	test   %eax,%eax
80108177:	75 0c                	jne    80108185 <copyuvm+0x71>
      panic("copyuvm: page not present");
80108179:	c7 04 24 8b 91 10 80 	movl   $0x8010918b,(%esp)
80108180:	e8 d0 83 ff ff       	call   80100555 <panic>
    pa = PTE_ADDR(*pte);
80108185:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108188:	8b 00                	mov    (%eax),%eax
8010818a:	25 00 f0 ff ff       	and    $0xfffff000,%eax
8010818f:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if((mem = kalloc()) == 0)
80108192:	e8 7a aa ff ff       	call   80102c11 <kalloc>
80108197:	89 45 e4             	mov    %eax,-0x1c(%ebp)
8010819a:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
8010819e:	74 6f                	je     8010820f <copyuvm+0xfb>
      goto bad;
    memmove(mem, (char*)p2v(pa), PGSIZE);
801081a0:	8b 45 e8             	mov    -0x18(%ebp),%eax
801081a3:	89 04 24             	mov    %eax,(%esp)
801081a6:	e8 65 f2 ff ff       	call   80107410 <p2v>
801081ab:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
801081b2:	00 
801081b3:	89 44 24 04          	mov    %eax,0x4(%esp)
801081b7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801081ba:	89 04 24             	mov    %eax,(%esp)
801081bd:	e8 ab cd ff ff       	call   80104f6d <memmove>
    if(mappages(d, (void*)i, PGSIZE, v2p(mem), PTE_W|PTE_U) < 0)
801081c2:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801081c5:	89 04 24             	mov    %eax,(%esp)
801081c8:	e8 36 f2 ff ff       	call   80107403 <v2p>
801081cd:	8b 55 f4             	mov    -0xc(%ebp),%edx
801081d0:	c7 44 24 10 06 00 00 	movl   $0x6,0x10(%esp)
801081d7:	00 
801081d8:	89 44 24 0c          	mov    %eax,0xc(%esp)
801081dc:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
801081e3:	00 
801081e4:	89 54 24 04          	mov    %edx,0x4(%esp)
801081e8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801081eb:	89 04 24             	mov    %eax,(%esp)
801081ee:	e8 3b f7 ff ff       	call   8010792e <mappages>
801081f3:	85 c0                	test   %eax,%eax
801081f5:	78 1b                	js     80108212 <copyuvm+0xfe>
  uint pa, i;
  char *mem;

  if((d = setupkvm()) == 0)
    return 0;
  for(i = 0; i < sz; i += PGSIZE){
801081f7:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
801081fe:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108201:	3b 45 0c             	cmp    0xc(%ebp),%eax
80108204:	0f 82 34 ff ff ff    	jb     8010813e <copyuvm+0x2a>
      goto bad;
    memmove(mem, (char*)p2v(pa), PGSIZE);
    if(mappages(d, (void*)i, PGSIZE, v2p(mem), PTE_W|PTE_U) < 0)
      goto bad;
  }
  return d;
8010820a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010820d:	eb 14                	jmp    80108223 <copyuvm+0x10f>
      panic("copyuvm: pte should exist");
    if(!(*pte & PTE_P))
      panic("copyuvm: page not present");
    pa = PTE_ADDR(*pte);
    if((mem = kalloc()) == 0)
      goto bad;
8010820f:	90                   	nop
80108210:	eb 01                	jmp    80108213 <copyuvm+0xff>
    memmove(mem, (char*)p2v(pa), PGSIZE);
    if(mappages(d, (void*)i, PGSIZE, v2p(mem), PTE_W|PTE_U) < 0)
      goto bad;
80108212:	90                   	nop
  }
  return d;

bad:
  freevm(d);
80108213:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108216:	89 04 24             	mov    %eax,(%esp)
80108219:	e8 fb fd ff ff       	call   80108019 <freevm>
  return 0;
8010821e:	b8 00 00 00 00       	mov    $0x0,%eax
}
80108223:	c9                   	leave  
80108224:	c3                   	ret    

80108225 <uva2ka>:

//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
80108225:	55                   	push   %ebp
80108226:	89 e5                	mov    %esp,%ebp
80108228:	83 ec 28             	sub    $0x28,%esp
  pte_t *pte;

  pte = walkpgdir(pgdir, uva, 0);
8010822b:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80108232:	00 
80108233:	8b 45 0c             	mov    0xc(%ebp),%eax
80108236:	89 44 24 04          	mov    %eax,0x4(%esp)
8010823a:	8b 45 08             	mov    0x8(%ebp),%eax
8010823d:	89 04 24             	mov    %eax,(%esp)
80108240:	e8 53 f6 ff ff       	call   80107898 <walkpgdir>
80108245:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if((*pte & PTE_P) == 0)
80108248:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010824b:	8b 00                	mov    (%eax),%eax
8010824d:	83 e0 01             	and    $0x1,%eax
80108250:	85 c0                	test   %eax,%eax
80108252:	75 07                	jne    8010825b <uva2ka+0x36>
    return 0;
80108254:	b8 00 00 00 00       	mov    $0x0,%eax
80108259:	eb 25                	jmp    80108280 <uva2ka+0x5b>
  if((*pte & PTE_U) == 0)
8010825b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010825e:	8b 00                	mov    (%eax),%eax
80108260:	83 e0 04             	and    $0x4,%eax
80108263:	85 c0                	test   %eax,%eax
80108265:	75 07                	jne    8010826e <uva2ka+0x49>
    return 0;
80108267:	b8 00 00 00 00       	mov    $0x0,%eax
8010826c:	eb 12                	jmp    80108280 <uva2ka+0x5b>
  return (char*)p2v(PTE_ADDR(*pte));
8010826e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108271:	8b 00                	mov    (%eax),%eax
80108273:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80108278:	89 04 24             	mov    %eax,(%esp)
8010827b:	e8 90 f1 ff ff       	call   80107410 <p2v>
}
80108280:	c9                   	leave  
80108281:	c3                   	ret    

80108282 <copyout>:
// Copy len bytes from p to user address va in page table pgdir.
// Most useful when pgdir is not the current page table.
// uva2ka ensures this only works for PTE_U pages.
int
copyout(pde_t *pgdir, uint va, void *p, uint len)
{
80108282:	55                   	push   %ebp
80108283:	89 e5                	mov    %esp,%ebp
80108285:	83 ec 28             	sub    $0x28,%esp
  char *buf, *pa0;
  uint n, va0;

  buf = (char*)p;
80108288:	8b 45 10             	mov    0x10(%ebp),%eax
8010828b:	89 45 f4             	mov    %eax,-0xc(%ebp)
  while(len > 0){
8010828e:	e9 8b 00 00 00       	jmp    8010831e <copyout+0x9c>
    va0 = (uint)PGROUNDDOWN(va);
80108293:	8b 45 0c             	mov    0xc(%ebp),%eax
80108296:	25 00 f0 ff ff       	and    $0xfffff000,%eax
8010829b:	89 45 ec             	mov    %eax,-0x14(%ebp)
    pa0 = uva2ka(pgdir, (char*)va0);
8010829e:	8b 45 ec             	mov    -0x14(%ebp),%eax
801082a1:	89 44 24 04          	mov    %eax,0x4(%esp)
801082a5:	8b 45 08             	mov    0x8(%ebp),%eax
801082a8:	89 04 24             	mov    %eax,(%esp)
801082ab:	e8 75 ff ff ff       	call   80108225 <uva2ka>
801082b0:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if(pa0 == 0)
801082b3:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
801082b7:	75 07                	jne    801082c0 <copyout+0x3e>
      return -1;
801082b9:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801082be:	eb 6d                	jmp    8010832d <copyout+0xab>
    n = PGSIZE - (va - va0);
801082c0:	8b 45 0c             	mov    0xc(%ebp),%eax
801082c3:	8b 55 ec             	mov    -0x14(%ebp),%edx
801082c6:	89 d1                	mov    %edx,%ecx
801082c8:	29 c1                	sub    %eax,%ecx
801082ca:	89 c8                	mov    %ecx,%eax
801082cc:	05 00 10 00 00       	add    $0x1000,%eax
801082d1:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(n > len)
801082d4:	8b 45 f0             	mov    -0x10(%ebp),%eax
801082d7:	3b 45 14             	cmp    0x14(%ebp),%eax
801082da:	76 06                	jbe    801082e2 <copyout+0x60>
      n = len;
801082dc:	8b 45 14             	mov    0x14(%ebp),%eax
801082df:	89 45 f0             	mov    %eax,-0x10(%ebp)
    memmove(pa0 + (va - va0), buf, n);
801082e2:	8b 45 ec             	mov    -0x14(%ebp),%eax
801082e5:	8b 55 0c             	mov    0xc(%ebp),%edx
801082e8:	89 d1                	mov    %edx,%ecx
801082ea:	29 c1                	sub    %eax,%ecx
801082ec:	89 c8                	mov    %ecx,%eax
801082ee:	03 45 e8             	add    -0x18(%ebp),%eax
801082f1:	8b 55 f0             	mov    -0x10(%ebp),%edx
801082f4:	89 54 24 08          	mov    %edx,0x8(%esp)
801082f8:	8b 55 f4             	mov    -0xc(%ebp),%edx
801082fb:	89 54 24 04          	mov    %edx,0x4(%esp)
801082ff:	89 04 24             	mov    %eax,(%esp)
80108302:	e8 66 cc ff ff       	call   80104f6d <memmove>
    len -= n;
80108307:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010830a:	29 45 14             	sub    %eax,0x14(%ebp)
    buf += n;
8010830d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108310:	01 45 f4             	add    %eax,-0xc(%ebp)
    va = va0 + PGSIZE;
80108313:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108316:	05 00 10 00 00       	add    $0x1000,%eax
8010831b:	89 45 0c             	mov    %eax,0xc(%ebp)
{
  char *buf, *pa0;
  uint n, va0;

  buf = (char*)p;
  while(len > 0){
8010831e:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
80108322:	0f 85 6b ff ff ff    	jne    80108293 <copyout+0x11>
    memmove(pa0 + (va - va0), buf, n);
    len -= n;
    buf += n;
    va = va0 + PGSIZE;
  }
  return 0;
80108328:	b8 00 00 00 00       	mov    $0x0,%eax
}
8010832d:	c9                   	leave  
8010832e:	c3                   	ret    
	...

80108330 <fdalloc>:


// Allocate a file descriptor for the given file.
// Takes over file reference from caller on success.
static int fdalloc(struct file *f)
{
80108330:	55                   	push   %ebp
80108331:	89 e5                	mov    %esp,%ebp
80108333:	83 ec 10             	sub    $0x10,%esp
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
80108336:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
8010833d:	eb 30                	jmp    8010836f <fdalloc+0x3f>
    if(proc->ofile[fd] == 0){
8010833f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80108345:	8b 55 fc             	mov    -0x4(%ebp),%edx
80108348:	83 c2 08             	add    $0x8,%edx
8010834b:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
8010834f:	85 c0                	test   %eax,%eax
80108351:	75 18                	jne    8010836b <fdalloc+0x3b>
      proc->ofile[fd] = f;
80108353:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80108359:	8b 55 fc             	mov    -0x4(%ebp),%edx
8010835c:	8d 4a 08             	lea    0x8(%edx),%ecx
8010835f:	8b 55 08             	mov    0x8(%ebp),%edx
80108362:	89 54 88 08          	mov    %edx,0x8(%eax,%ecx,4)
      return fd;
80108366:	8b 45 fc             	mov    -0x4(%ebp),%eax
80108369:	eb 0f                	jmp    8010837a <fdalloc+0x4a>
// Takes over file reference from caller on success.
static int fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
8010836b:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
8010836f:	83 7d fc 0f          	cmpl   $0xf,-0x4(%ebp)
80108373:	7e ca                	jle    8010833f <fdalloc+0xf>
    if(proc->ofile[fd] == 0){
      proc->ofile[fd] = f;
      return fd;
    }
  }
  return -1;
80108375:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
8010837a:	c9                   	leave  
8010837b:	c3                   	ret    

8010837c <create>:

static struct inode* create(char *path, short type, short major, short minor)
{
8010837c:	55                   	push   %ebp
8010837d:	89 e5                	mov    %esp,%ebp
8010837f:	83 ec 48             	sub    $0x48,%esp
80108382:	8b 4d 0c             	mov    0xc(%ebp),%ecx
80108385:	8b 55 10             	mov    0x10(%ebp),%edx
80108388:	8b 45 14             	mov    0x14(%ebp),%eax
8010838b:	66 89 4d d4          	mov    %cx,-0x2c(%ebp)
8010838f:	66 89 55 d0          	mov    %dx,-0x30(%ebp)
80108393:	66 89 45 cc          	mov    %ax,-0x34(%ebp)
  uint off;
  struct inode *ip, *dp;
  char name[DIRSIZ];

  if((dp = nameiparent(path, name)) == 0)
80108397:	8d 45 de             	lea    -0x22(%ebp),%eax
8010839a:	89 44 24 04          	mov    %eax,0x4(%esp)
8010839e:	8b 45 08             	mov    0x8(%ebp),%eax
801083a1:	89 04 24             	mov    %eax,(%esp)
801083a4:	e8 93 a0 ff ff       	call   8010243c <nameiparent>
801083a9:	89 45 f4             	mov    %eax,-0xc(%ebp)
801083ac:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801083b0:	75 0a                	jne    801083bc <create+0x40>
    return 0;
801083b2:	b8 00 00 00 00       	mov    $0x0,%eax
801083b7:	e9 7e 01 00 00       	jmp    8010853a <create+0x1be>
  ilock(dp);
801083bc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801083bf:	89 04 24             	mov    %eax,(%esp)
801083c2:	e8 b1 94 ff ff       	call   80101878 <ilock>

  if((ip = dirlookup(dp, name, &off)) != 0){
801083c7:	8d 45 ec             	lea    -0x14(%ebp),%eax
801083ca:	89 44 24 08          	mov    %eax,0x8(%esp)
801083ce:	8d 45 de             	lea    -0x22(%ebp),%eax
801083d1:	89 44 24 04          	mov    %eax,0x4(%esp)
801083d5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801083d8:	89 04 24             	mov    %eax,(%esp)
801083db:	e8 b1 9c ff ff       	call   80102091 <dirlookup>
801083e0:	89 45 f0             	mov    %eax,-0x10(%ebp)
801083e3:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801083e7:	74 47                	je     80108430 <create+0xb4>
    iunlockput(dp);
801083e9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801083ec:	89 04 24             	mov    %eax,(%esp)
801083ef:	e8 08 97 ff ff       	call   80101afc <iunlockput>
    ilock(ip);
801083f4:	8b 45 f0             	mov    -0x10(%ebp),%eax
801083f7:	89 04 24             	mov    %eax,(%esp)
801083fa:	e8 79 94 ff ff       	call   80101878 <ilock>
    if(type == T_FILE && ip->type == T_FILE)
801083ff:	66 83 7d d4 02       	cmpw   $0x2,-0x2c(%ebp)
80108404:	75 15                	jne    8010841b <create+0x9f>
80108406:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108409:	0f b7 40 10          	movzwl 0x10(%eax),%eax
8010840d:	66 83 f8 02          	cmp    $0x2,%ax
80108411:	75 08                	jne    8010841b <create+0x9f>
      return ip;
80108413:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108416:	e9 1f 01 00 00       	jmp    8010853a <create+0x1be>
    iunlockput(ip);
8010841b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010841e:	89 04 24             	mov    %eax,(%esp)
80108421:	e8 d6 96 ff ff       	call   80101afc <iunlockput>
    return 0;
80108426:	b8 00 00 00 00       	mov    $0x0,%eax
8010842b:	e9 0a 01 00 00       	jmp    8010853a <create+0x1be>
  }

  if((ip = ialloc(dp->dev, type)) == 0)
80108430:	0f bf 55 d4          	movswl -0x2c(%ebp),%edx
80108434:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108437:	8b 00                	mov    (%eax),%eax
80108439:	89 54 24 04          	mov    %edx,0x4(%esp)
8010843d:	89 04 24             	mov    %eax,(%esp)
80108440:	e8 9a 91 ff ff       	call   801015df <ialloc>
80108445:	89 45 f0             	mov    %eax,-0x10(%ebp)
80108448:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
8010844c:	75 0c                	jne    8010845a <create+0xde>
    panic("create: ialloc");
8010844e:	c7 04 24 a5 91 10 80 	movl   $0x801091a5,(%esp)
80108455:	e8 fb 80 ff ff       	call   80100555 <panic>

  ilock(ip);
8010845a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010845d:	89 04 24             	mov    %eax,(%esp)
80108460:	e8 13 94 ff ff       	call   80101878 <ilock>
  ip->major = major;
80108465:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108468:	0f b7 55 d0          	movzwl -0x30(%ebp),%edx
8010846c:	66 89 50 12          	mov    %dx,0x12(%eax)
  ip->minor = minor;
80108470:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108473:	0f b7 55 cc          	movzwl -0x34(%ebp),%edx
80108477:	66 89 50 14          	mov    %dx,0x14(%eax)
  ip->nlink = 1;
8010847b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010847e:	66 c7 40 16 01 00    	movw   $0x1,0x16(%eax)
  iupdate(ip);
80108484:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108487:	89 04 24             	mov    %eax,(%esp)
8010848a:	e8 2d 92 ff ff       	call   801016bc <iupdate>

  if(type == T_DIR){  // Create . and .. entries.
8010848f:	66 83 7d d4 01       	cmpw   $0x1,-0x2c(%ebp)
80108494:	75 6a                	jne    80108500 <create+0x184>
    dp->nlink++;  // for ".."
80108496:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108499:	0f b7 40 16          	movzwl 0x16(%eax),%eax
8010849d:	8d 50 01             	lea    0x1(%eax),%edx
801084a0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801084a3:	66 89 50 16          	mov    %dx,0x16(%eax)
    iupdate(dp);
801084a7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801084aa:	89 04 24             	mov    %eax,(%esp)
801084ad:	e8 0a 92 ff ff       	call   801016bc <iupdate>
    // No ip->nlink++ for ".": avoid cyclic ref count.
    if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
801084b2:	8b 45 f0             	mov    -0x10(%ebp),%eax
801084b5:	8b 40 04             	mov    0x4(%eax),%eax
801084b8:	89 44 24 08          	mov    %eax,0x8(%esp)
801084bc:	c7 44 24 04 b4 91 10 	movl   $0x801091b4,0x4(%esp)
801084c3:	80 
801084c4:	8b 45 f0             	mov    -0x10(%ebp),%eax
801084c7:	89 04 24             	mov    %eax,(%esp)
801084ca:	e8 8a 9c ff ff       	call   80102159 <dirlink>
801084cf:	85 c0                	test   %eax,%eax
801084d1:	78 21                	js     801084f4 <create+0x178>
801084d3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801084d6:	8b 40 04             	mov    0x4(%eax),%eax
801084d9:	89 44 24 08          	mov    %eax,0x8(%esp)
801084dd:	c7 44 24 04 b6 91 10 	movl   $0x801091b6,0x4(%esp)
801084e4:	80 
801084e5:	8b 45 f0             	mov    -0x10(%ebp),%eax
801084e8:	89 04 24             	mov    %eax,(%esp)
801084eb:	e8 69 9c ff ff       	call   80102159 <dirlink>
801084f0:	85 c0                	test   %eax,%eax
801084f2:	79 0c                	jns    80108500 <create+0x184>
      panic("create dots");
801084f4:	c7 04 24 b9 91 10 80 	movl   $0x801091b9,(%esp)
801084fb:	e8 55 80 ff ff       	call   80100555 <panic>
  }

  if(dirlink(dp, name, ip->inum) < 0)
80108500:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108503:	8b 40 04             	mov    0x4(%eax),%eax
80108506:	89 44 24 08          	mov    %eax,0x8(%esp)
8010850a:	8d 45 de             	lea    -0x22(%ebp),%eax
8010850d:	89 44 24 04          	mov    %eax,0x4(%esp)
80108511:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108514:	89 04 24             	mov    %eax,(%esp)
80108517:	e8 3d 9c ff ff       	call   80102159 <dirlink>
8010851c:	85 c0                	test   %eax,%eax
8010851e:	79 0c                	jns    8010852c <create+0x1b0>
    panic("create: dirlink");
80108520:	c7 04 24 c5 91 10 80 	movl   $0x801091c5,(%esp)
80108527:	e8 29 80 ff ff       	call   80100555 <panic>

  iunlockput(dp);
8010852c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010852f:	89 04 24             	mov    %eax,(%esp)
80108532:	e8 c5 95 ff ff       	call   80101afc <iunlockput>

  return ip;
80108537:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
8010853a:	c9                   	leave  
8010853b:	c3                   	ret    

8010853c <f_open>:

// Open file
int f_open(char *path, int omode)
{
8010853c:	55                   	push   %ebp
8010853d:	89 e5                	mov    %esp,%ebp
8010853f:	83 ec 28             	sub    $0x28,%esp
  int fd;
  struct file *f;
  struct inode *ip;

  if(omode & O_CREATE){
80108542:	8b 45 0c             	mov    0xc(%ebp),%eax
80108545:	25 00 02 00 00       	and    $0x200,%eax
8010854a:	85 c0                	test   %eax,%eax
8010854c:	74 40                	je     8010858e <f_open+0x52>
    begin_trans();
8010854e:	e8 de ad ff ff       	call   80103331 <begin_trans>
    ip = create(path, T_FILE, 0, 0);
80108553:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
8010855a:	00 
8010855b:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80108562:	00 
80108563:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
8010856a:	00 
8010856b:	8b 45 08             	mov    0x8(%ebp),%eax
8010856e:	89 04 24             	mov    %eax,(%esp)
80108571:	e8 06 fe ff ff       	call   8010837c <create>
80108576:	89 45 f4             	mov    %eax,-0xc(%ebp)
    commit_trans();
80108579:	e8 fc ad ff ff       	call   8010337a <commit_trans>
    if(ip == 0)
8010857e:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80108582:	75 5b                	jne    801085df <f_open+0xa3>
      return -1;
80108584:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80108589:	e9 f9 00 00 00       	jmp    80108687 <f_open+0x14b>
  } else {
    if((ip = namei(path)) == 0)
8010858e:	8b 45 08             	mov    0x8(%ebp),%eax
80108591:	89 04 24             	mov    %eax,(%esp)
80108594:	e8 81 9e ff ff       	call   8010241a <namei>
80108599:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010859c:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801085a0:	75 0a                	jne    801085ac <f_open+0x70>
      return -1;
801085a2:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801085a7:	e9 db 00 00 00       	jmp    80108687 <f_open+0x14b>
    ilock(ip);
801085ac:	8b 45 f4             	mov    -0xc(%ebp),%eax
801085af:	89 04 24             	mov    %eax,(%esp)
801085b2:	e8 c1 92 ff ff       	call   80101878 <ilock>
    if(ip->type == T_DIR && omode != O_RDONLY){
801085b7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801085ba:	0f b7 40 10          	movzwl 0x10(%eax),%eax
801085be:	66 83 f8 01          	cmp    $0x1,%ax
801085c2:	75 1b                	jne    801085df <f_open+0xa3>
801085c4:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
801085c8:	74 15                	je     801085df <f_open+0xa3>
      iunlockput(ip);
801085ca:	8b 45 f4             	mov    -0xc(%ebp),%eax
801085cd:	89 04 24             	mov    %eax,(%esp)
801085d0:	e8 27 95 ff ff       	call   80101afc <iunlockput>
      return -1;
801085d5:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801085da:	e9 a8 00 00 00       	jmp    80108687 <f_open+0x14b>
    }
  }

  if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
801085df:	e8 48 89 ff ff       	call   80100f2c <filealloc>
801085e4:	89 45 f0             	mov    %eax,-0x10(%ebp)
801085e7:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801085eb:	74 14                	je     80108601 <f_open+0xc5>
801085ed:	8b 45 f0             	mov    -0x10(%ebp),%eax
801085f0:	89 04 24             	mov    %eax,(%esp)
801085f3:	e8 38 fd ff ff       	call   80108330 <fdalloc>
801085f8:	89 45 ec             	mov    %eax,-0x14(%ebp)
801085fb:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
801085ff:	79 23                	jns    80108624 <f_open+0xe8>
    if(f)
80108601:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80108605:	74 0b                	je     80108612 <f_open+0xd6>
      fileclose(f);
80108607:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010860a:	89 04 24             	mov    %eax,(%esp)
8010860d:	e8 c2 89 ff ff       	call   80100fd4 <fileclose>
    iunlockput(ip);
80108612:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108615:	89 04 24             	mov    %eax,(%esp)
80108618:	e8 df 94 ff ff       	call   80101afc <iunlockput>
    return -1;
8010861d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80108622:	eb 63                	jmp    80108687 <f_open+0x14b>
  }
  iunlock(ip);
80108624:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108627:	89 04 24             	mov    %eax,(%esp)
8010862a:	e8 97 93 ff ff       	call   801019c6 <iunlock>

  f->type = FD_INODE;
8010862f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108632:	c7 00 02 00 00 00    	movl   $0x2,(%eax)
  f->ip = ip;
80108638:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010863b:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010863e:	89 50 10             	mov    %edx,0x10(%eax)
  f->off = 0;
80108641:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108644:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
  f->readable = !(omode & O_WRONLY);
8010864b:	8b 45 0c             	mov    0xc(%ebp),%eax
8010864e:	83 e0 01             	and    $0x1,%eax
80108651:	85 c0                	test   %eax,%eax
80108653:	0f 94 c2             	sete   %dl
80108656:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108659:	88 50 08             	mov    %dl,0x8(%eax)
  f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
8010865c:	8b 45 0c             	mov    0xc(%ebp),%eax
8010865f:	83 e0 01             	and    $0x1,%eax
80108662:	84 c0                	test   %al,%al
80108664:	75 0a                	jne    80108670 <f_open+0x134>
80108666:	8b 45 0c             	mov    0xc(%ebp),%eax
80108669:	83 e0 02             	and    $0x2,%eax
8010866c:	85 c0                	test   %eax,%eax
8010866e:	74 07                	je     80108677 <f_open+0x13b>
80108670:	b8 01 00 00 00       	mov    $0x1,%eax
80108675:	eb 05                	jmp    8010867c <f_open+0x140>
80108677:	b8 00 00 00 00       	mov    $0x0,%eax
8010867c:	89 c2                	mov    %eax,%edx
8010867e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108681:	88 50 09             	mov    %dl,0x9(%eax)
  return fd;
80108684:	8b 45 ec             	mov    -0x14(%ebp),%eax
}
80108687:	c9                   	leave  
80108688:	c3                   	ret    

80108689 <f_close>:



void f_close(int fd, struct file *f)
{
80108689:	55                   	push   %ebp
8010868a:	89 e5                	mov    %esp,%ebp
8010868c:	83 ec 18             	sub    $0x18,%esp
  proc->ofile[fd] = 0;
8010868f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80108695:	8b 55 08             	mov    0x8(%ebp),%edx
80108698:	83 c2 08             	add    $0x8,%edx
8010869b:	c7 44 90 08 00 00 00 	movl   $0x0,0x8(%eax,%edx,4)
801086a2:	00 
  fileclose(f);
801086a3:	8b 45 0c             	mov    0xc(%ebp),%eax
801086a6:	89 04 24             	mov    %eax,(%esp)
801086a9:	e8 26 89 ff ff       	call   80100fd4 <fileclose>
  //return 0;
}
801086ae:	c9                   	leave  
801086af:	c3                   	ret    

801086b0 <get_debug_switch>:
//pde_t *s_pgdir_debug;
struct inode *swapper_inode;
char swapper_inited = 0;

int get_debug_switch()
{
801086b0:	55                   	push   %ebp
801086b1:	89 e5                	mov    %esp,%ebp
    return debug_switch;
801086b3:	a1 50 c6 10 80       	mov    0x8010c650,%eax
}
801086b8:	5d                   	pop    %ebp
801086b9:	c3                   	ret    

801086ba <set_debug_switch>:
void set_debug_switch()
{
801086ba:	55                   	push   %ebp
801086bb:	89 e5                	mov    %esp,%ebp
    debug_switch = 1;
801086bd:	c7 05 50 c6 10 80 01 	movl   $0x1,0x8010c650
801086c4:	00 00 00 
}
801086c7:	5d                   	pop    %ebp
801086c8:	c3                   	ret    

801086c9 <swapper_create>:


struct inode* swapper_create()
{
801086c9:	55                   	push   %ebp
801086ca:	89 e5                	mov    %esp,%ebp
801086cc:	83 ec 48             	sub    $0x48,%esp
  uint off;
  struct inode *ip, *dp;
  char name[DIRSIZ];
  short major = 0, minor = 0;
801086cf:	66 c7 45 f6 00 00    	movw   $0x0,-0xa(%ebp)
801086d5:	66 c7 45 f4 00 00    	movw   $0x0,-0xc(%ebp)
  short type = T_FILE;
801086db:	66 c7 45 f2 02 00    	movw   $0x2,-0xe(%ebp)
  char path[] = "swap_file";
801086e1:	c7 45 cc 73 77 61 70 	movl   $0x70617773,-0x34(%ebp)
801086e8:	c7 45 d0 5f 66 69 6c 	movl   $0x6c69665f,-0x30(%ebp)
801086ef:	66 c7 45 d4 65 00    	movw   $0x65,-0x2c(%ebp)

  if((dp = nameiparent(path, name)) == 0)
801086f5:	8d 45 d6             	lea    -0x2a(%ebp),%eax
801086f8:	89 44 24 04          	mov    %eax,0x4(%esp)
801086fc:	8d 45 cc             	lea    -0x34(%ebp),%eax
801086ff:	89 04 24             	mov    %eax,(%esp)
80108702:	e8 35 9d ff ff       	call   8010243c <nameiparent>
80108707:	89 45 ec             	mov    %eax,-0x14(%ebp)
8010870a:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
8010870e:	75 0a                	jne    8010871a <swapper_create+0x51>
    return 0;
80108710:	b8 00 00 00 00       	mov    $0x0,%eax
80108715:	e9 0d 01 00 00       	jmp    80108827 <swapper_create+0x15e>
  ilock(dp);
8010871a:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010871d:	89 04 24             	mov    %eax,(%esp)
80108720:	e8 53 91 ff ff       	call   80101878 <ilock>

  if((ip = dirlookup(dp, name, &off)) != 0){
80108725:	8d 45 e4             	lea    -0x1c(%ebp),%eax
80108728:	89 44 24 08          	mov    %eax,0x8(%esp)
8010872c:	8d 45 d6             	lea    -0x2a(%ebp),%eax
8010872f:	89 44 24 04          	mov    %eax,0x4(%esp)
80108733:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108736:	89 04 24             	mov    %eax,(%esp)
80108739:	e8 53 99 ff ff       	call   80102091 <dirlookup>
8010873e:	89 45 e8             	mov    %eax,-0x18(%ebp)
80108741:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
80108745:	74 47                	je     8010878e <swapper_create+0xc5>
    iunlockput(dp);
80108747:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010874a:	89 04 24             	mov    %eax,(%esp)
8010874d:	e8 aa 93 ff ff       	call   80101afc <iunlockput>
    ilock(ip);
80108752:	8b 45 e8             	mov    -0x18(%ebp),%eax
80108755:	89 04 24             	mov    %eax,(%esp)
80108758:	e8 1b 91 ff ff       	call   80101878 <ilock>
    if(type == T_FILE && ip->type == T_FILE)
8010875d:	66 83 7d f2 02       	cmpw   $0x2,-0xe(%ebp)
80108762:	75 15                	jne    80108779 <swapper_create+0xb0>
80108764:	8b 45 e8             	mov    -0x18(%ebp),%eax
80108767:	0f b7 40 10          	movzwl 0x10(%eax),%eax
8010876b:	66 83 f8 02          	cmp    $0x2,%ax
8010876f:	75 08                	jne    80108779 <swapper_create+0xb0>
      return ip;
80108771:	8b 45 e8             	mov    -0x18(%ebp),%eax
80108774:	e9 ae 00 00 00       	jmp    80108827 <swapper_create+0x15e>
    iunlockput(ip);
80108779:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010877c:	89 04 24             	mov    %eax,(%esp)
8010877f:	e8 78 93 ff ff       	call   80101afc <iunlockput>
    return 0;
80108784:	b8 00 00 00 00       	mov    $0x0,%eax
80108789:	e9 99 00 00 00       	jmp    80108827 <swapper_create+0x15e>
  }

  if((ip = ialloc(dp->dev, type)) == 0)
8010878e:	0f bf 55 f2          	movswl -0xe(%ebp),%edx
80108792:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108795:	8b 00                	mov    (%eax),%eax
80108797:	89 54 24 04          	mov    %edx,0x4(%esp)
8010879b:	89 04 24             	mov    %eax,(%esp)
8010879e:	e8 3c 8e ff ff       	call   801015df <ialloc>
801087a3:	89 45 e8             	mov    %eax,-0x18(%ebp)
801087a6:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
801087aa:	75 0c                	jne    801087b8 <swapper_create+0xef>
    panic("create: ialloc");
801087ac:	c7 04 24 d5 91 10 80 	movl   $0x801091d5,(%esp)
801087b3:	e8 9d 7d ff ff       	call   80100555 <panic>

  ilock(ip);
801087b8:	8b 45 e8             	mov    -0x18(%ebp),%eax
801087bb:	89 04 24             	mov    %eax,(%esp)
801087be:	e8 b5 90 ff ff       	call   80101878 <ilock>
  ip->major = major;
801087c3:	8b 45 e8             	mov    -0x18(%ebp),%eax
801087c6:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
801087ca:	66 89 50 12          	mov    %dx,0x12(%eax)
  ip->minor = minor;
801087ce:	8b 45 e8             	mov    -0x18(%ebp),%eax
801087d1:	0f b7 55 f4          	movzwl -0xc(%ebp),%edx
801087d5:	66 89 50 14          	mov    %dx,0x14(%eax)
  ip->nlink = 1;
801087d9:	8b 45 e8             	mov    -0x18(%ebp),%eax
801087dc:	66 c7 40 16 01 00    	movw   $0x1,0x16(%eax)
  iupdate(ip);
801087e2:	8b 45 e8             	mov    -0x18(%ebp),%eax
801087e5:	89 04 24             	mov    %eax,(%esp)
801087e8:	e8 cf 8e ff ff       	call   801016bc <iupdate>
  //   // No ip->nlink++ for ".": avoid cyclic ref count.
  //   if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
  //     panic("create dots");
  // }

  if(dirlink(dp, name, ip->inum) < 0)
801087ed:	8b 45 e8             	mov    -0x18(%ebp),%eax
801087f0:	8b 40 04             	mov    0x4(%eax),%eax
801087f3:	89 44 24 08          	mov    %eax,0x8(%esp)
801087f7:	8d 45 d6             	lea    -0x2a(%ebp),%eax
801087fa:	89 44 24 04          	mov    %eax,0x4(%esp)
801087fe:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108801:	89 04 24             	mov    %eax,(%esp)
80108804:	e8 50 99 ff ff       	call   80102159 <dirlink>
80108809:	85 c0                	test   %eax,%eax
8010880b:	79 0c                	jns    80108819 <swapper_create+0x150>
    panic("create: dirlink");
8010880d:	c7 04 24 e4 91 10 80 	movl   $0x801091e4,(%esp)
80108814:	e8 3c 7d ff ff       	call   80100555 <panic>

  iunlockput(dp);
80108819:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010881c:	89 04 24             	mov    %eax,(%esp)
8010881f:	e8 d8 92 ff ff       	call   80101afc <iunlockput>

  return ip;
80108824:	8b 45 e8             	mov    -0x18(%ebp),%eax
}
80108827:	c9                   	leave  
80108828:	c3                   	ret    

80108829 <swapper_init>:

void swapper_init()
{
80108829:	55                   	push   %ebp
8010882a:	89 e5                	mov    %esp,%ebp
8010882c:	83 ec 18             	sub    $0x18,%esp
    if(swapper_inited == 1) return;
8010882f:	0f b6 05 54 c6 10 80 	movzbl 0x8010c654,%eax
80108836:	3c 01                	cmp    $0x1,%al
80108838:	74 15                	je     8010884f <swapper_init+0x26>
    swapper_inited = 1;
8010883a:	c6 05 54 c6 10 80 01 	movb   $0x1,0x8010c654

    // Create swap file
    //swapper_inode = swapper_create();
    //s_pgdir_debug = setupkvm();
    cprintf("Swapper has been initialized.");
80108841:	c7 04 24 f4 91 10 80 	movl   $0x801091f4,(%esp)
80108848:	e8 54 7b ff ff       	call   801003a1 <cprintf>
8010884d:	eb 01                	jmp    80108850 <swapper_init+0x27>
  return ip;
}

void swapper_init()
{
    if(swapper_inited == 1) return;
8010884f:	90                   	nop

    // Create swap file
    //swapper_inode = swapper_create();
    //s_pgdir_debug = setupkvm();
    cprintf("Swapper has been initialized.");
}
80108850:	c9                   	leave  
80108851:	c3                   	ret    

80108852 <test_writefile>:
//   f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
//   return fd;
// }

void test_writefile()
{
80108852:	55                   	push   %ebp
80108853:	89 e5                	mov    %esp,%ebp
80108855:	83 ec 18             	sub    $0x18,%esp
    // int omode;
    // struct file* f;
    // struct inode *ip;
    cprintf("debug switch = %d\n",debug_switch);
80108858:	a1 50 c6 10 80       	mov    0x8010c650,%eax
8010885d:	89 44 24 04          	mov    %eax,0x4(%esp)
80108861:	c7 04 24 12 92 10 80 	movl   $0x80109212,(%esp)
80108868:	e8 34 7b ff ff       	call   801003a1 <cprintf>

    if(debug_switch == 0) return;
8010886d:	a1 50 c6 10 80       	mov    0x8010c650,%eax
80108872:	85 c0                	test   %eax,%eax
80108874:	90                   	nop

    //create_file();
}
80108875:	c9                   	leave  
80108876:	c3                   	ret    

80108877 <swap_out>:

void swap_out(struct proc *p)
{
80108877:	55                   	push   %ebp
80108878:	89 e5                	mov    %esp,%ebp
    //(*p)->tf
}
8010887a:	5d                   	pop    %ebp
8010887b:	c3                   	ret    
